diff options
| author | Jabiertxof <jtx@jtx> | 2017-05-01 01:21:44 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx> | 2017-05-01 01:21:44 +0000 |
| commit | 3be0cd064d48cfe0601d365fb52f729a776d462b (patch) | |
| tree | 1b4f8c65753bc149ca39f7dac7b381c50351114e | |
| parent | minor bugfixing (diff) | |
| parent | Fix erase lpe in multi LPE mode (diff) | |
| download | inkscape-3be0cd064d48cfe0601d365fb52f729a776d462b.tar.gz inkscape-3be0cd064d48cfe0601d365fb52f729a776d462b.zip | |
Update to trunk
(bzr r15620.1.14)
27 files changed, 220 insertions, 101 deletions
diff --git a/CMakeScripts/DefineDependsandFlags.cmake b/CMakeScripts/DefineDependsandFlags.cmake index 29ccb3a91..8cc0f0cd9 100644 --- a/CMakeScripts/DefineDependsandFlags.cmake +++ b/CMakeScripts/DefineDependsandFlags.cmake @@ -39,6 +39,7 @@ if(WIN32) endif() endif() +find_package(PkgConfig REQUIRED) pkg_check_modules(INKSCAPE_DEP REQUIRED harfbuzz pangocairo diff --git a/CMakeScripts/HelperFunctions.cmake b/CMakeScripts/HelperFunctions.cmake index f4ed255d5..3cd9e2736 100644 --- a/CMakeScripts/HelperFunctions.cmake +++ b/CMakeScripts/HelperFunctions.cmake @@ -1,10 +1,8 @@ # pkg_check_variable() - a function to retrieve pkg-config variables in CMake # # source: http://bloerg.net/2015/03/06/pkg-config-variables-in-cmake.html - -find_package(PkgConfig REQUIRED) - function(pkg_check_variable _pkg _name) + find_package(PkgConfig REQUIRED) string(TOUPPER ${_pkg} _pkg_upper) string(TOUPPER ${_name} _name_upper) string(REPLACE "-" "_" _pkg_upper ${_pkg_upper}) @@ -32,3 +30,138 @@ function(join OUTPUT GLUE) endforeach() set(${OUTPUT} "${_TMP_RESULT}" PARENT_SCOPE) endfunction() + + + +# Checks if the last call to execute_process() was sucessful and throws an error otherwise. +# ${result} and ${stderr} should hold the value of RESULT_VARIABLE and ERROR_VARIABLE respectively +function(check_error result stderr) + if("${result}" STREQUAL 0) + if(NOT "${stderr}" STREQUAL "") + MESSAGE(WARNING "Process returned sucessfully but the following was output to stderr: ${stderr}") + endif() + else() + if("${stderr}" STREQUAL "") + MESSAGE(FATAL_ERROR "Process failed with error code: ${result}") + else() + MESSAGE(FATAL_ERROR "Process failed with error code: ${result} (stderr: ${stderr})") + endif() + endif() +endfunction(check_error) + + + +# Get the list of files installed by pacman for package ${package_name} and return it as ${file_list}. +# Paths are relative to the root directory of the MinGW installations (the directory returned by function "get_mingw_root()") +function(list_files_pacman package_name file_list) + set(MINGW_PACKAGE_PREFIX $ENV{MINGW_PACKAGE_PREFIX}) # e.g. "mingw-w64-x86_64" + get_filename_component(MINGW_PREFIX $ENV{MINGW_PREFIX} NAME) # e.g. "mingw64" + + # use pacman to list all files/folders installed by the package + execute_process( + COMMAND pacman -Ql ${MINGW_PACKAGE_PREFIX}-${package_name} + OUTPUT_FILE list_files_pacman_temp.txt + RESULT_VARIABLE res + ERROR_VARIABLE err + ) + check_error("${res}" "${err}") + + # clean up output + execute_process( + COMMAND grep -v '/$' # get rid of folders + COMMAND sed -e 's/^${MINGW_PACKAGE_PREFIX}-${package_name} //' # remove package name + COMMAND sed -e 's/^\\/${MINGW_PREFIX}\\///' # remove root path + COMMAND tr '\n' '\;' # finally replace newlines with semicolon + INPUT_FILE list_files_pacman_temp.txt + OUTPUT_VARIABLE out + RESULT_VARIABLE res + ERROR_VARIABLE err + ) + check_error("${res}" "${err}") + + SET(${file_list} ${out} PARENT_SCOPE) + file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/list_files_pacman_temp.txt) +endfunction(list_files_pacman) + + + +# Get the list of files installed by pip for package ${package_name} and return it as ${file_list}. +# Paths are relative to the python distributions "site-packages" folder, i.e. "${root}/lib/python2.7/site-packages" +function(list_files_pip package_name file_list) + # use pip to show package information including full list of files installed by the package + execute_process( + COMMAND pip show -f ${package_name} + OUTPUT_FILE list_files_pip_temp.txt + RESULT_VARIABLE res + ERROR_VARIABLE err + ) + check_error("${res}" "${err}") + + # clean up output + execute_process( + COMMAND sed -e '1,/Files:/d' # strip everything but the files list + COMMAND tr -d ' ' # strip spaces + COMMAND tr '\n' '\;' # finally replace newlines with semicolon + INPUT_FILE list_files_pip_temp.txt + OUTPUT_VARIABLE out + RESULT_VARIABLE res + ERROR_VARIABLE err + ) + check_error("${res}" "${err}") + + SET(${file_list} ${out} PARENT_SCOPE) + file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/list_files_pip_temp.txt) +endfunction(list_files_pip) + + + +# Install a list of files maintaining directory structure +# +# Options: +# FILES - the list of files (absolute or relative paths) +# ROOT - the root to search the files in (if file paths are relative) +# DESTINATION - the destination where to install files to +# INCLUDE - a (list of) regular expression(s) specifying which files to include +# (omit or leave empty to inlcude all files) +# EXCLUDE - a (list of) regular expression(s) specifying which files to exclude +# (takes precedence over include rules) +function(install_list) + # parse arguments + set(oneValueArgs ROOT DESTINATION) + set(multiValueArgs FILES INCLUDE EXCLUDE) + cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + #MESSAGE("ARG_FILES: ${ARG_FILES}" ) + #MESSAGE("ARG_ROOT: ${ARG_ROOT}" ) + #MESSAGE("ARG_DESTINATION: ${ARG_DESTINATION}" ) + #MESSAGE("ARG_INCLUDE: ${ARG_INCLUDE}" ) + #MESSAGE("ARG_EXCLUDE: ${ARG_EXCLUDE}" ) + #MESSAGE("ARG_UNPARSED_ARGUMENTS: ${ARG_UNPARSED_ARGUMENTS}" ) + + # install the files + foreach(file ${ARG_FILES}) + #MESSAGE("file: " ${file}) + + # check includes and excludes (excludes take precedence) + set(include_file 0) + if("${ARG_INCLUDE}" STREQUAL "") # start with the assumption to include all files by default + set(include_file 1) + endif() + foreach(include ${ARG_INCLUDE}) + if("${file}" MATCHES "${include}") + set(include_file 1) + endif() + endforeach() + foreach(exclude ${ARG_EXCLUDE}) + if("${file}" MATCHES "${exclude}") + set(include_file 0) + endif() + endforeach() + + # install if file should be included + if(${include_file}) + get_filename_component(directory ${file} DIRECTORY) + install(FILES "${ARG_ROOT}/${file}" DESTINATION "${ARG_DESTINATION}${directory}") + endif() + endforeach() +endfunction(install_list) diff --git a/CMakeScripts/Install.cmake b/CMakeScripts/Install.cmake index 9250f3d00..f1fda7bcc 100644 --- a/CMakeScripts/Install.cmake +++ b/CMakeScripts/Install.cmake @@ -34,6 +34,9 @@ if(WIN32) LGPL2.1.txt
DESTINATION ${CMAKE_INSTALL_PREFIX})
+ install(DIRECTORY doc
+ DESTINATION ${CMAKE_INSTALL_PREFIX})
+
# devlibs and mingw dlls
# There are differences in the devlibs for 64-Bit and 32-Bit build environments.
@@ -178,23 +181,6 @@ if(WIN32) DESTINATION ${CMAKE_INSTALL_PREFIX})
endif()
- # Setup application data directories, poppler files, locales, icons and themes
- file(MAKE_DIRECTORY
- data
- doc
- modules
- plugins)
-
- install(DIRECTORY
- data
- doc
- modules
- plugins
- DESTINATION ${CMAKE_INSTALL_PREFIX}
- PATTERN hicolor/index.theme EXCLUDE # NOTE: Empty index.theme in hicolor icon theme causes SIGSEGV.
- PATTERN CMakeLists.txt EXCLUDE
- PATTERN *.am EXCLUDE)
-
# Generate a dummy file in hicolor/index.theme to avoid bug 1635207
file(GENERATE OUTPUT ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/index.theme
CONTENT "[Icon Theme]\nName=hicolor\nDirectories=")
diff --git a/CMakeScripts/InstallMSYS2.cmake b/CMakeScripts/InstallMSYS2.cmake index bff09cabf..c6690bbe9 100644 --- a/CMakeScripts/InstallMSYS2.cmake +++ b/CMakeScripts/InstallMSYS2.cmake @@ -27,6 +27,9 @@ if(WIN32) LGPL2.1.txt
DESTINATION ${CMAKE_INSTALL_PREFIX})
+ install(DIRECTORY doc
+ DESTINATION ${CMAKE_INSTALL_PREFIX})
+
# mingw dlls
install(FILES
${MINGW_BIN}/LIBEAY32.dll
@@ -142,23 +145,6 @@ if(WIN32) DESTINATION ${CMAKE_INSTALL_PREFIX})
endif()
- # Setup application data directories, poppler files, locales, icons and themes
- file(MAKE_DIRECTORY
- data
- doc
- modules
- plugins)
-
- install(DIRECTORY
- data
- doc
- modules
- plugins
- DESTINATION ${CMAKE_INSTALL_PREFIX}
- PATTERN hicolor/index.theme EXCLUDE # NOTE: Empty index.theme in hicolor icon theme causes SIGSEGV.
- PATTERN CMakeLists.txt EXCLUDE
- PATTERN *.am EXCLUDE)
-
# Install hicolor/index.theme to avoid bug 1635207
install(FILES
${MINGW_PATH}/share/icons/hicolor/index.theme
@@ -173,7 +159,7 @@ if(WIN32) FILES_MATCHING
PATTERN "*gtk30.mo"
PATTERN "*gtkspell3.mo")
-
+
install(DIRECTORY ${MINGW_PATH}/share/poppler
DESTINATION ${CMAKE_INSTALL_PREFIX}/share)
@@ -234,5 +220,27 @@ if(WIN32) ${MINGW_BIN}/libpython2.7.dll
DESTINATION ${CMAKE_INSTALL_PREFIX})
install(DIRECTORY ${MINGW_LIB}/python2.7
- DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
+ PATTERN "python2.7/site-packages" EXCLUDE)
+
+ set(site_packages "lib/python2.7/site-packages")
+ # Python packages installed via pacman
+ set(packages "python2-lxml" "python2-numpy")
+ foreach(package ${packages})
+ list_files_pacman(${package} paths)
+ install_list(FILES ${paths}
+ ROOT ${MINGW_PATH}
+ INCLUDE ${site_packages} # only include content from "site-packages" (we might consider to install everything)
+ )
+ endforeach()
+ # Python packages installed via pip
+ set(packages "coverage" "pyserial" "scour" "six")
+ foreach(package ${packages})
+ list_files_pip(${package} paths)
+ install_list(FILES ${paths}
+ ROOT ${MINGW_PATH}/${site_packages}
+ DESTINATION ${site_packages}/
+ EXCLUDE "^\\.\\.\\/" # exclude content in parent directories (notably scripts installed to /bin)
+ )
+ endforeach()
endif()
\ No newline at end of file diff --git a/share/filters/CMakeLists.txt b/share/filters/CMakeLists.txt index 72403deda..dc3e19c97 100644 --- a/share/filters/CMakeLists.txt +++ b/share/filters/CMakeLists.txt @@ -8,5 +8,4 @@ set_source_files_properties(${CMAKE_SOURCE_DIR}/filters.svg.h PROPERTIES GENERAT add_custom_target(filters_svg_h ALL DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/filters.svg.h) -install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/filters.svg.h DESTINATION ${INKSCAPE_SHARE_INSTALL}/filters) install(FILES "filters.svg" "README" DESTINATION ${INKSCAPE_SHARE_INSTALL}/filters) diff --git a/share/palettes/CMakeLists.txt b/share/palettes/CMakeLists.txt index d76920524..f734564ac 100644 --- a/share/palettes/CMakeLists.txt +++ b/share/palettes/CMakeLists.txt @@ -12,4 +12,4 @@ add_custom_target(palettes_h ALL DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/palettes.h) file(GLOB _FILES "*.gpl") -install(FILES ${_FILES} "README" ${CMAKE_CURRENT_SOURCE_DIR}/palettes.h DESTINATION ${INKSCAPE_SHARE_INSTALL}/palettes) +install(FILES ${_FILES} "README" DESTINATION ${INKSCAPE_SHARE_INSTALL}/palettes) diff --git a/share/patterns/CMakeLists.txt b/share/patterns/CMakeLists.txt index 70cc61b58..10bb848b6 100644 --- a/share/patterns/CMakeLists.txt +++ b/share/patterns/CMakeLists.txt @@ -7,5 +7,4 @@ add_custom_command( set_source_files_properties(${CMAKE_SOURCE_DIR}/patterns.svg.h PROPERTIES GENERATED TRUE) add_custom_target(patterns_svg_h ALL DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/patterns.svg.h) -install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/patterns.svg.h DESTINATION ${INKSCAPE_SHARE_INSTALL}/patterns) install(FILES "patterns.svg" "README" DESTINATION ${INKSCAPE_SHARE_INSTALL}/patterns) diff --git a/share/symbols/CMakeLists.txt b/share/symbols/CMakeLists.txt index af562a46d..5a7eb1c9e 100644 --- a/share/symbols/CMakeLists.txt +++ b/share/symbols/CMakeLists.txt @@ -9,4 +9,4 @@ add_custom_command( set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/symbols.h PROPERTIES GENERATED TRUE) add_custom_target(symbols_h ALL DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/symbols.h) -install(FILES ${_FILES} "README" ${CMAKE_CURRENT_SOURCE_DIR}/symbols.h DESTINATION ${INKSCAPE_SHARE_INSTALL}/symbols) +install(FILES ${_FILES} "README" DESTINATION ${INKSCAPE_SHARE_INSTALL}/symbols) diff --git a/share/templates/CMakeLists.txt b/share/templates/CMakeLists.txt index fa1bc01bd..4af166bf1 100644 --- a/share/templates/CMakeLists.txt +++ b/share/templates/CMakeLists.txt @@ -9,4 +9,4 @@ add_custom_command( set_source_files_properties(${CMAKE_SOURCE_DIR}/templates.h PROPERTIES GENERATED TRUE) add_custom_target(templates_h ALL DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/templates.h) -install(FILES ${_FILES} "README" ${CMAKE_CURRENT_SOURCE_DIR}/templates.h DESTINATION ${INKSCAPE_SHARE_INSTALL}/templates) +install(FILES ${_FILES} "README" DESTINATION ${INKSCAPE_SHARE_INSTALL}/templates) diff --git a/src/extension/internal/cdr-input.cpp b/src/extension/internal/cdr-input.cpp index 70bf84ef4..b94408b36 100644 --- a/src/extension/internal/cdr-input.cpp +++ b/src/extension/internal/cdr-input.cpp @@ -210,6 +210,19 @@ void CdrImportDialog::_setPreviewPage() } SPDocument *doc = SPDocument::createNewDocFromMem(_vec[_current_page-1].cstr(), strlen(_vec[_current_page-1].cstr()), 0); + if(!doc) { + g_warning("CDR import: Could not create preview for page %d", _current_page); + gchar const *no_preview_template = + "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'>" + " <path style='fill:none;stroke:#ff0000;stroke-width:2px;' d='M 82,10 18,74 m 0,-64 64,64' />" + " <rect style='fill:none;stroke:#000000;stroke-width:1.5px;' width='64' height='64' x='18' y='10' />" + " <text x='50' y='92' style='font-size:10px;text-anchor:middle;font-family:sans-serif;'>%s</text>" + "</svg>"; + gchar * no_preview = g_strdup_printf(no_preview_template, _("No preview")); + doc = SPDocument::createNewDocFromMem(no_preview, strlen(no_preview), 0); + g_free(no_preview); + } + Gtk::Widget * tmpPreviewArea = Glib::wrap(sp_svg_view_widget_new(doc)); std::swap(_previewArea, tmpPreviewArea); delete tmpPreviewArea; diff --git a/src/extension/internal/vsd-input.cpp b/src/extension/internal/vsd-input.cpp index b7277b99e..c1cfb5cc6 100644 --- a/src/extension/internal/vsd-input.cpp +++ b/src/extension/internal/vsd-input.cpp @@ -146,7 +146,7 @@ VsdImportDialog::VsdImportDialog(const std::vector<RVNGString> &vec) _page_selector_box->pack_start(*_labelTotalPages, Gtk::PACK_SHRINK); vbox1->pack_end(*_page_selector_box, Gtk::PACK_SHRINK); - + // Buttons cancelbutton = Gtk::manage(new Gtk::Button(_("_Cancel"), true)); okbutton = Gtk::manage(new Gtk::Button(_("_OK"), true)); @@ -211,6 +211,19 @@ void VsdImportDialog::_setPreviewPage() } SPDocument *doc = SPDocument::createNewDocFromMem(_vec[_current_page-1].cstr(), strlen(_vec[_current_page-1].cstr()), 0); + if(!doc) { + g_warning("VSD import: Could not create preview for page %d", _current_page); + gchar const *no_preview_template = + "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'>" + " <path style='fill:none;stroke:#ff0000;stroke-width:2px;' d='M 82,10 18,74 m 0,-64 64,64' />" + " <rect style='fill:none;stroke:#000000;stroke-width:1.5px;' width='64' height='64' x='18' y='10' />" + " <text x='50' y='92' style='font-size:10px;text-anchor:middle;font-family:sans-serif;'>%s</text>" + "</svg>"; + gchar * no_preview = g_strdup_printf(no_preview_template, _("No preview")); + doc = SPDocument::createNewDocFromMem(no_preview, strlen(no_preview), 0); + g_free(no_preview); + } + Gtk::Widget * tmpPreviewArea = Glib::wrap(sp_svg_view_widget_new(doc)); std::swap(_previewArea, tmpPreviewArea); delete tmpPreviewArea; diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 22cc5567b..7f34ebf05 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -359,7 +359,6 @@ Effect::Effect(LivePathEffectObject *lpeobject) concatenate_before_pwd2(false), sp_lpe_item(NULL), current_zoom(1), - upd_params(true), sp_shape(NULL), sp_curve(NULL), provides_own_flash_paths(true), // is automatically set to false if providesOwnFlashPaths() is not overridden @@ -782,7 +781,6 @@ Effect::newWidget() ++it; } - upd_params = false; return dynamic_cast<Gtk::Widget *>(vbox); } diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h index c34c391c0..c16bb48ce 100644 --- a/src/live_effects/effect.h +++ b/src/live_effects/effect.h @@ -133,7 +133,6 @@ public: void editNextParamOncanvas(SPItem * item, SPDesktop * desktop); bool apply_to_clippath_and_mask; bool erase_extra_objects; // set this to false allow retain extra generated objects, see measure line LPE - bool upd_params; BoolParam is_visible; SPCurve * sp_curve; Geom::PathVector pathvector_before_effect; diff --git a/src/live_effects/lpe-clone-original.cpp b/src/live_effects/lpe-clone-original.cpp index 47fb6a04e..d97a990af 100644 --- a/src/live_effects/lpe-clone-original.cpp +++ b/src/live_effects/lpe-clone-original.cpp @@ -318,7 +318,6 @@ LPECloneOriginal::newWidget() expander->set_expanded(expanded); expander->property_expanded().signal_changed().connect(sigc::mem_fun(*this, &LPECloneOriginal::onExpanderChanged) ); vbox->pack_start(*expander, true, true, 2); - this->upd_params = false; return dynamic_cast<Gtk::Widget *>(vbox); } diff --git a/src/live_effects/lpe-copy_rotate.cpp b/src/live_effects/lpe-copy_rotate.cpp index 4869e8279..900fc8b67 100644 --- a/src/live_effects/lpe-copy_rotate.cpp +++ b/src/live_effects/lpe-copy_rotate.cpp @@ -362,23 +362,19 @@ LPECopyRotate::doBeforeEffect (SPLPEItem const* lpeitem) using namespace Geom; original_bbox(lpeitem); if (copies_to_360 && num_copies > 2) { - this->upd_params = true; rotation_angle.param_set_value(360.0/(double)num_copies); } if ((method == RM_KALEIDOSCOPE || method == RM_FUSE) && rotation_angle * num_copies > 360.1 && rotation_angle > 0) { - this->upd_params = true; num_copies.param_set_value(floor(360/rotation_angle)); } if ((method == RM_KALEIDOSCOPE || method == RM_FUSE) && mirror_copies && copies_to_360) { - this->upd_params = true; num_copies.param_set_increments(2.0,10.0); if ((int)num_copies%2 !=0) { num_copies.param_set_value(num_copies+1); rotation_angle.param_set_value(360.0/(double)num_copies); } } else { - this->upd_params = true; num_copies.param_set_increments(1.0, 10.0); } @@ -392,7 +388,6 @@ LPECopyRotate::doBeforeEffect (SPLPEItem const* lpeitem) // likely due to SVG's choice of coordinate system orientation (max) bool near = Geom::are_near(previous_start_point, (Geom::Point)starting_point, 0.01); if (!near) { - this->upd_params = true; starting_angle.param_set_value(deg_from_rad(-angle_between(dir, starting_point - origin))); if (GDK_SHIFT_MASK) { dist_angle_handle = L2(B - A); @@ -407,7 +402,6 @@ LPECopyRotate::doBeforeEffect (SPLPEItem const* lpeitem) rot_pos = origin + dir * Rotate(-rad_from_deg(rotation_angle+starting_angle)) * dist_angle_handle; near = Geom::are_near(start_pos, (Geom::Point)starting_point, 0.01); if (!near) { - this->upd_params = true; starting_point.param_setValue(start_pos, true); } previous_start_point = (Geom::Point)starting_point; diff --git a/src/live_effects/lpe-measure-line.cpp b/src/live_effects/lpe-measure-line.cpp index 52aa56fa0..892744462 100644 --- a/src/live_effects/lpe-measure-line.cpp +++ b/src/live_effects/lpe-measure-line.cpp @@ -511,7 +511,6 @@ LPEMeasureLine::doBeforeEffect (SPLPEItem const* lpeitem) pathvector *= writed_transform; if ((Glib::ustring(format.param_getSVGValue()).empty())) { format.param_setValue(Glib::ustring("{measure}{unit}")); - this->upd_params = true; } size_t ncurves = pathvector.curveCount(); if (ncurves != (size_t)curve_linked.param_get_max()) { diff --git a/src/live_effects/lpe-mirror_symmetry.cpp b/src/live_effects/lpe-mirror_symmetry.cpp index 97015c34d..b411bd699 100644 --- a/src/live_effects/lpe-mirror_symmetry.cpp +++ b/src/live_effects/lpe-mirror_symmetry.cpp @@ -335,7 +335,6 @@ LPEMirrorSymmetry::newWidget() ++it; } - this->upd_params = false; return dynamic_cast<Gtk::Widget *>(vbox); } diff --git a/src/live_effects/parameter/bool.cpp b/src/live_effects/parameter/bool.cpp index fafa71368..1df13b11a 100644 --- a/src/live_effects/parameter/bool.cpp +++ b/src/live_effects/parameter/bool.cpp @@ -78,7 +78,6 @@ BoolParam::param_newWidget() checkwdg->setActive(value); checkwdg->setProgrammatically = false; checkwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change bool parameter")); - param_effect->upd_params = false; return dynamic_cast<Gtk::Widget *> (checkwdg); } else { return NULL; @@ -88,7 +87,6 @@ BoolParam::param_newWidget() void BoolParam::param_setValue(bool newvalue) { - param_effect->upd_params = true; value = newvalue; } diff --git a/src/live_effects/parameter/fontbutton.cpp b/src/live_effects/parameter/fontbutton.cpp index 5ec98df8c..89ead122d 100644 --- a/src/live_effects/parameter/fontbutton.cpp +++ b/src/live_effects/parameter/fontbutton.cpp @@ -68,7 +68,6 @@ FontButtonParam::param_newWidget() Glib::ustring fontspec = param_getSVGValue(); fontbuttonwdg->setValue( fontspec); fontbuttonwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change font button parameter")); - param_effect->upd_params = false; return dynamic_cast<Gtk::Widget *> (fontbuttonwdg); } diff --git a/src/live_effects/parameter/parameter.cpp b/src/live_effects/parameter/parameter.cpp index e35c89c09..569736735 100644 --- a/src/live_effects/parameter/parameter.cpp +++ b/src/live_effects/parameter/parameter.cpp @@ -121,7 +121,6 @@ ScalarParam::param_update_default(const gchar * default_value) void ScalarParam::param_set_value(gdouble val) { - param_effect->upd_params = true; value = val; if (integer) value = round(value); @@ -139,7 +138,6 @@ ScalarParam::param_set_range(gdouble min, gdouble max) // Once again, in gtk2, this is not a problem. But in gtk3, // widgets get allocated the amount of size they ask for, // leading to excessively long widgets. - param_effect->upd_params = true; if (min >= -SCALARPARAM_G_MAXDOUBLE) { this->min = min; } else { @@ -156,7 +154,6 @@ ScalarParam::param_set_range(gdouble min, gdouble max) void ScalarParam::param_make_integer(bool yes) { - param_effect->upd_params = true; integer = yes; digits = 0; inc_step = 1; @@ -187,7 +184,6 @@ ScalarParam::param_newWidget() if(!overwrite_widget){ rsu->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change scalar parameter")); } - param_effect->upd_params = false; return dynamic_cast<Gtk::Widget *> (rsu); } else { return NULL; @@ -197,14 +193,12 @@ ScalarParam::param_newWidget() void ScalarParam::param_set_digits(unsigned digits) { - param_effect->upd_params = true; this->digits = digits; } void ScalarParam::param_set_increments(double step, double page) { - param_effect->upd_params = true; inc_step = step; inc_page = page; } diff --git a/src/live_effects/parameter/point.cpp b/src/live_effects/parameter/point.cpp index 561f1b34c..20d8a3392 100644 --- a/src/live_effects/parameter/point.cpp +++ b/src/live_effects/parameter/point.cpp @@ -90,7 +90,6 @@ PointParam::param_setValue(Geom::Point newpoint, bool write) if(knoth && liveupdate){ knoth->update_knots(); } - param_effect->upd_params = true; } bool @@ -143,7 +142,6 @@ PointParam::param_newWidget() Gtk::HBox * hbox = Gtk::manage( new Gtk::HBox() ); static_cast<Gtk::HBox*>(hbox)->pack_start(*pointwdg, true, true); static_cast<Gtk::HBox*>(hbox)->show_all_children(); - param_effect->upd_params = false; return dynamic_cast<Gtk::Widget *> (hbox); } diff --git a/src/live_effects/parameter/text.cpp b/src/live_effects/parameter/text.cpp index 84603149e..4062a4dc7 100644 --- a/src/live_effects/parameter/text.cpp +++ b/src/live_effects/parameter/text.cpp @@ -125,14 +125,12 @@ TextParam::param_newWidget() rsu->setProgrammatically = false; rsu->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change text parameter")); - param_effect->upd_params = false; return dynamic_cast<Gtk::Widget *> (rsu); } void TextParam::param_setValue(const Glib::ustring newvalue) { - param_effect->upd_params = true; value = newvalue; if (!_hide_canvas_text) { sp_canvastext_set_text (canvas_text, newvalue.c_str()); diff --git a/src/live_effects/parameter/togglebutton.cpp b/src/live_effects/parameter/togglebutton.cpp index b8058e9c8..fb4ba3dc4 100644 --- a/src/live_effects/parameter/togglebutton.cpp +++ b/src/live_effects/parameter/togglebutton.cpp @@ -124,7 +124,6 @@ ToggleButtonParam::param_newWidget() checkwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change togglebutton parameter")); _toggled_connection = checkwdg->signal_toggled().connect(sigc::mem_fun(*this, &ToggleButtonParam::toggled)); - param_effect->upd_params = false; return checkwdg; } @@ -171,8 +170,6 @@ ToggleButtonParam::param_setValue(bool newvalue) void ToggleButtonParam::toggled() { - //Force redraw for update widgets - param_effect->upd_params = true; if (SP_ACTIVE_DESKTOP) { Inkscape::Selection *selection = SP_ACTIVE_DESKTOP->getSelection(); selection->emitModified(); diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index ca0f78a00..b5c89b69d 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -493,8 +493,8 @@ void SPLPEItem::removeCurrentPathEffect(bool keep_paths) } PathEffectList new_list = *this->path_effect_list; new_list.remove(lperef); //current lpe ref is always our 'own' pointer from the path_effect_list + *this->path_effect_list = new_list; this->getRepr()->setAttribute("inkscape:path-effect", patheffectlist_svg_string(new_list)); - if (!keep_paths) { // Make sure that ellipse is stored as <svg:circle> or <svg:ellipse> if possible. if( SP_IS_GENERICELLIPSE(this)) { diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index f0ccce6d4..f3fec2df4 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -47,17 +47,18 @@ namespace Dialog { /*#################### * Callback functions */ + + void lpeeditor_selection_changed (Inkscape::Selection * selection, gpointer data) { LivePathEffectEditor *lpeeditor = static_cast<LivePathEffectEditor *>(data); lpeeditor->lpe_list_locked = false; - lpeeditor->onSelectionChanged(selection, true); + lpeeditor->onSelectionChanged(selection); } -static void lpeeditor_selection_modified (Inkscape::Selection * selection, guint /*flags*/, gpointer data) +void lpeeditor_selection_modified (Inkscape::Selection * selection, guint /*flags*/, gpointer data) { - LivePathEffectEditor *lpeeditor = static_cast<LivePathEffectEditor *>(data); - lpeeditor->onSelectionChanged(selection); + lpeeditor_selection_changed (selection, data); } static void lpe_style_button(Gtk::Button& btn, char const* iconName) @@ -184,15 +185,13 @@ LivePathEffectEditor::~LivePathEffectEditor() if (current_desktop) { selection_changed_connection.disconnect(); selection_modified_connection.disconnect(); + selection_moved_connection.disconnect(); } } void LivePathEffectEditor::showParams(LivePathEffect::Effect& effect) { - if ( ! effect.upd_params ) { - return; - } bool expanderopen = false; Gtk::Widget * defaultswidget = effect.defaultParamSet(); if (effectwidget) { @@ -272,16 +271,15 @@ LivePathEffectEditor::set_sensitize_all(bool sensitive) } void -LivePathEffectEditor::onSelectionChanged(Inkscape::Selection *sel, bool upd_params) +LivePathEffectEditor::onSelectionChanged(Inkscape::Selection *sel) { if (lpe_list_locked) { // this was triggered by selecting a row in the list, so skip reloading lpe_list_locked = false; return; } - - effectlist_store->clear(); current_lpeitem = NULL; + effectlist_store->clear(); if ( sel && !sel->isEmpty() ) { SPItem *item = sel->singleItem(); @@ -296,9 +294,6 @@ LivePathEffectEditor::onSelectionChanged(Inkscape::Selection *sel, bool upd_para if ( lpeitem->hasPathEffect() ) { Inkscape::LivePathEffect::Effect *lpe = lpeitem->getCurrentLPE(); if (lpe) { - if (upd_params) { - lpe->upd_params = true; - } showParams(*lpe); lpe_list_locked = true; selectInList(lpe); @@ -502,18 +497,12 @@ LivePathEffectEditor::onRemove() SPItem *item = sel->singleItem(); SPLPEItem *lpeitem = dynamic_cast<SPLPEItem *>(item); if ( lpeitem ) { - if (current_lperef && current_lperef->lpeobject) { - LivePathEffect::Effect * effect = current_lperef->lpeobject->get_lpe(); - if (effect) { - effect->upd_params = true; - } - } lpeitem->removeCurrentPathEffect(false); - + current_lperef = NULL; DocumentUndo::done( current_desktop->getDocument(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Remove path effect") ); - - effect_list_reload(lpeitem); + lpe_list_locked = false; + onSelectionChanged(sel); } } @@ -530,7 +519,7 @@ void LivePathEffectEditor::onUp() DocumentUndo::done( current_desktop->getDocument(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Move path effect up") ); - + effect_list_reload(lpeitem); } } @@ -547,7 +536,6 @@ void LivePathEffectEditor::onDown() DocumentUndo::done( current_desktop->getDocument(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Move path effect down") ); - effect_list_reload(lpeitem); } } @@ -572,7 +560,6 @@ void LivePathEffectEditor::on_effect_selection_changed() current_lperef = lperef; LivePathEffect::Effect * effect = lperef->lpeobject->get_lpe(); if (effect) { - effect->upd_params = true; showParams(*effect); } } @@ -581,6 +568,7 @@ void LivePathEffectEditor::on_effect_selection_changed() void LivePathEffectEditor::on_visibility_toggled( Glib::ustring const& str ) { + Gtk::TreeModel::Children::iterator iter = effectlist_view.get_model()->get_iter(str); Gtk::TreeModel::Row row = *iter; diff --git a/src/ui/dialog/livepatheffect-editor.h b/src/ui/dialog/livepatheffect-editor.h index a7c749ef3..e9769ffea 100644 --- a/src/ui/dialog/livepatheffect-editor.h +++ b/src/ui/dialog/livepatheffect-editor.h @@ -45,7 +45,7 @@ public: static LivePathEffectEditor &getInstance() { return *new LivePathEffectEditor(); } - void onSelectionChanged(Inkscape::Selection *sel, bool upd_params = false); + void onSelectionChanged(Inkscape::Selection *sel); void onSelectionModified(Inkscape::Selection *sel); virtual void on_effect_selection_changed(); void setDesktop(SPDesktop *desktop); @@ -63,6 +63,7 @@ private: sigc::connection desktopChangeConn; sigc::connection selection_changed_connection; sigc::connection selection_modified_connection; + sigc::connection selection_moved_connection; // void add_entry(const char* name ); void effect_list_reload(SPLPEItem *lpeitem); @@ -126,6 +127,7 @@ private: LivePathEffect::LPEObjectReference * current_lperef; friend void lpeeditor_selection_changed (Inkscape::Selection * selection, gpointer data); + friend void lpeeditor_selection_modified (Inkscape::Selection * selection, guint /*flags*/, gpointer data); LivePathEffectEditor(LivePathEffectEditor const &d); LivePathEffectEditor& operator=(LivePathEffectEditor const &d); diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp index ae6f238d4..d8e0f5418 100644 --- a/src/xml/repr-io.cpp +++ b/src/xml/repr-io.cpp @@ -404,7 +404,12 @@ Document *sp_repr_read_mem (const gchar * buffer, gint length, const gchar *defa g_return_val_if_fail (buffer != NULL, NULL); - doc = xmlParseMemory (const_cast<gchar *>(buffer), length); + int parser_options = XML_PARSE_HUGE | XML_PARSE_RECOVER; + parser_options |= XML_PARSE_NONET; // TODO: should we allow network access? + // proper solution would be to check the preference "/options/externalresources/xml/allow_net_access" + // as done in XmlSource::readXml which gets called by the analogous sp_repr_read_file() + // but sp_repr_read_mem() seems to be called in locations where Inkscape::Preferences::get() fails badly + doc = xmlReadMemory (const_cast<gchar *>(buffer), length, NULL, NULL, parser_options); rdoc = sp_repr_do_read (doc, default_ns); if (doc) { |
