From fb6ee4a8495b064e6a64e1abec212941ce7c96f9 Mon Sep 17 00:00:00 2001 From: rafael-g Date: Sun, 5 Jun 2016 08:32:58 +0200 Subject: [Bug #1550178] Inkscape crashed with segfault in ExpressionEvaluator on OpenBSD. Fixed bugs: - https://launchpad.net/bugs/1550178 (bzr r14951) --- src/util/expression-evaluator.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/util/expression-evaluator.cpp b/src/util/expression-evaluator.cpp index 48064e647..b0b8e6036 100644 --- a/src/util/expression-evaluator.cpp +++ b/src/util/expression-evaluator.cpp @@ -28,6 +28,8 @@ #include "util/expression-evaluator.h" #include "util/units.h" +#include + #include #include @@ -49,7 +51,7 @@ EvaluatorToken::EvaluatorToken() } ExpressionEvaluator::ExpressionEvaluator(const char *string, Unit const *unit) : - string(string), + string(g_locale_to_utf8(string,-1,0,0,0)), unit(unit) { current_token.type = TOKEN_END; -- cgit v1.2.3 From 8e79c58572bac72489bde00c15d092bce02e850a Mon Sep 17 00:00:00 2001 From: rafael-g Date: Sun, 5 Jun 2016 08:43:06 +0200 Subject: [Bug #1587311] Entering + into stroke width dialog crashes Inkscape. Fixed bugs: - https://launchpad.net/bugs/1587311 (bzr r14952) --- src/util/expression-evaluator.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/util/expression-evaluator.cpp b/src/util/expression-evaluator.cpp index b0b8e6036..dd7ce97f7 100644 --- a/src/util/expression-evaluator.cpp +++ b/src/util/expression-evaluator.cpp @@ -208,8 +208,11 @@ EvaluatorQuantity ExpressionEvaluator::evaluateFactor() { EvaluatorQuantity evaluated_factor = EvaluatorQuantity(); EvaluatorToken consumed_token = EvaluatorToken(); - - if (acceptToken(TOKEN_NUM, &consumed_token)) { + + if (acceptToken(TOKEN_END, &consumed_token)) { + return evaluated_factor; + } + else if (acceptToken(TOKEN_NUM, &consumed_token)) { evaluated_factor.value = consumed_token.value.fl; } else if (acceptToken('(', NULL)) { evaluated_factor = evaluateExpression(); -- cgit v1.2.3 From 6f15692726681034391d42c58aa870e9dbba642f Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 5 Jun 2016 19:35:39 +0200 Subject: Extensions: Fixes and improvements for "gui-text" parameter attribute - "gui-text" was always translated (as opposed to only "_gui-text") - This made it impossible to have parameters without label (since the empty string returns the whole .po file header when translated), which caused an issue in restack extension - Added possibility to specify "msgctxt" for "gui-text" (bzr r14955) --- src/extension/param/bool.cpp | 2 +- src/extension/param/enum.cpp | 2 +- src/extension/param/float.cpp | 4 ++-- src/extension/param/int.cpp | 4 ++-- src/extension/param/parameter.cpp | 11 +++++++++++ src/extension/param/radiobutton.cpp | 2 +- src/extension/param/string.cpp | 2 +- 7 files changed, 19 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/extension/param/bool.cpp b/src/extension/param/bool.cpp index de9b1c586..87364d80f 100644 --- a/src/extension/param/bool.cpp +++ b/src/extension/param/bool.cpp @@ -137,7 +137,7 @@ Gtk::Widget *ParamBool::get_widget(SPDocument * doc, Inkscape::XML::Node * node, Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); #endif - Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START)); + Gtk::Label * label = Gtk::manage(new Gtk::Label(_text, Gtk::ALIGN_START)); label->show(); hbox->pack_end(*label, true, true); diff --git a/src/extension/param/enum.cpp b/src/extension/param/enum.cpp index 8bc0fbda7..4e7420807 100644 --- a/src/extension/param/enum.cpp +++ b/src/extension/param/enum.cpp @@ -251,7 +251,7 @@ Gtk::Widget *ParamComboBox::get_widget(SPDocument * doc, Inkscape::XML::Node * n } Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); - Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START)); + Gtk::Label * label = Gtk::manage(new Gtk::Label(_text, Gtk::ALIGN_START)); label->show(); hbox->pack_start(*label, false, false, _indent); diff --git a/src/extension/param/float.cpp b/src/extension/param/float.cpp index 81508f6c0..4e3cbfedc 100644 --- a/src/extension/param/float.cpp +++ b/src/extension/param/float.cpp @@ -186,7 +186,7 @@ Gtk::Widget * ParamFloat::get_widget(SPDocument * doc, Inkscape::XML::Node * nod if (_mode == FULL) { - UI::Widget::SpinScale *scale = new UI::Widget::SpinScale(_(_text), fadjust, _precision); + UI::Widget::SpinScale *scale = new UI::Widget::SpinScale(_text, fadjust, _precision); scale->set_size_request(400, -1); scale->show(); hbox->pack_start(*scale, false, false); @@ -194,7 +194,7 @@ Gtk::Widget * ParamFloat::get_widget(SPDocument * doc, Inkscape::XML::Node * nod } else if (_mode == MINIMAL) { - Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START)); + Gtk::Label * label = Gtk::manage(new Gtk::Label(_text, Gtk::ALIGN_START)); label->show(); hbox->pack_start(*label, true, true, _indent); diff --git a/src/extension/param/int.cpp b/src/extension/param/int.cpp index c286018fd..605aab5ad 100644 --- a/src/extension/param/int.cpp +++ b/src/extension/param/int.cpp @@ -168,14 +168,14 @@ ParamInt::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal if (_mode == FULL) { - UI::Widget::SpinScale *scale = new UI::Widget::SpinScale(_(_text), fadjust, 0); + UI::Widget::SpinScale *scale = new UI::Widget::SpinScale(_text, fadjust, 0); scale->set_size_request(400, -1); scale->show(); hbox->pack_start(*scale, false, false); } else if (_mode == MINIMAL) { - Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START)); + Gtk::Label * label = Gtk::manage(new Gtk::Label(_text, Gtk::ALIGN_START)); label->show(); hbox->pack_start(*label, true, true, _indent); diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index 10029893f..27d9bdf9b 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -20,6 +20,7 @@ #endif #include +#include #include "ui/widget/color-notebook.h" #include @@ -56,6 +57,16 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex const char *guitext = in_repr->attribute("gui-text"); if (guitext == NULL) { guitext = in_repr->attribute("_gui-text"); + if (guitext == NULL) { + // guitext = ""; // propably better to require devs to explicitly set an empty gui-text if this is what they want + } else { + const char *context = in_repr->attribute("msgctxt"); + if (context != NULL) { + guitext = g_dpgettext2(NULL, context, guitext); + } else { + guitext = _(guitext); + } + } } const char *gui_tip = in_repr->attribute("gui-tip"); if (gui_tip == NULL) { diff --git a/src/extension/param/radiobutton.cpp b/src/extension/param/radiobutton.cpp index 8181c6f51..1d1b860c6 100644 --- a/src/extension/param/radiobutton.cpp +++ b/src/extension/param/radiobutton.cpp @@ -313,7 +313,7 @@ Gtk::Widget * ParamRadioButton::get_widget(SPDocument * doc, Inkscape::XML::Node Gtk::VBox * vbox = Gtk::manage(new Gtk::VBox(false, 0)); #endif - Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START, Gtk::ALIGN_START)); + Gtk::Label * label = Gtk::manage(new Gtk::Label(_text, Gtk::ALIGN_START, Gtk::ALIGN_START)); label->show(); hbox->pack_start(*label, false, false, _indent); diff --git a/src/extension/param/string.cpp b/src/extension/param/string.cpp index 1d9205502..6b082b133 100644 --- a/src/extension/param/string.cpp +++ b/src/extension/param/string.cpp @@ -166,7 +166,7 @@ Gtk::Widget * ParamString::get_widget(SPDocument * doc, Inkscape::XML::Node * no } Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); - Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START)); + Gtk::Label * label = Gtk::manage(new Gtk::Label(_text, Gtk::ALIGN_START)); label->show(); hbox->pack_start(*label, false, false, _indent); -- cgit v1.2.3 From 78f92b4e7ad3d0448f90584fa57070dfbc17916c Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Wed, 8 Jun 2016 09:01:39 +0200 Subject: Fix wrong string in measure code. Noticed to translators. Thanks CRogers fro the text (bzr r14959) --- src/ui/tools/measure-tool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ui/tools/measure-tool.cpp b/src/ui/tools/measure-tool.cpp index 287828d32..5900a2359 100644 --- a/src/ui/tools/measure-tool.cpp +++ b/src/ui/tools/measure-tool.cpp @@ -778,7 +778,7 @@ void MeasureTool::toPhantom() measure_tmp_items.clear(); showCanvasItems(false, false, true); doc->ensureUpToDate(); - DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_MEASURE,_("Add Stored to measure tool")); + DocumentUndo::done(desktop->getDocument(), SP_VERB_CONTEXT_MEASURE,_("Keep last measure on the canvas, for reference")); } void MeasureTool::toItem() -- cgit v1.2.3 From fe77182372c47e5fcd9a11629f75de8304a97726 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Wed, 8 Jun 2016 09:05:19 +0200 Subject: [Bug #1590171] Fill and Stroke dialog shows wrong label for Radial gradient. Fixed bugs: - https://launchpad.net/bugs/1590171 (bzr r14960) --- src/widgets/paint-selector.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/paint-selector.cpp b/src/widgets/paint-selector.cpp index aafa6bd1e..58a178aec 100644 --- a/src/widgets/paint-selector.cpp +++ b/src/widgets/paint-selector.cpp @@ -789,7 +789,7 @@ static void sp_paint_selector_set_mode_gradient(SPPaintSelector *psel, SPPaintSe SP_GRADIENT_SELECTOR(gsel)->setMode(SPGradientSelector::MODE_LINEAR); //sp_gradient_selector_set_mode(SP_GRADIENT_SELECTOR(gsel), SP_GRADIENT_SELECTOR_MODE_LINEAR); gtk_label_set_markup(GTK_LABEL(psel->label), _("Linear gradient")); - } else if (mode == SPPaintSelector::MODE_GRADIENT_LINEAR) { + } else if (mode == SPPaintSelector::MODE_GRADIENT_RADIAL) { SP_GRADIENT_SELECTOR(gsel)->setMode(SPGradientSelector::MODE_RADIAL); gtk_label_set_markup(GTK_LABEL(psel->label), _("Radial gradient")); } -- cgit v1.2.3 From 2546a959c920d3df18271f9a9aed42bf574df3c1 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Wed, 8 Jun 2016 10:27:17 +0200 Subject: Store rest of string in Inkscape version ('pre' 'devel'). Fix try/catch blocks by really throwing errors. (stringstream doesn't throw errors by default.) (bzr r14962) --- src/version.cpp | 12 ++++++++++-- src/version.h | 3 +++ 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/version.cpp b/src/version.cpp index abe855ee7..7610cd8e7 100644 --- a/src/version.cpp +++ b/src/version.cpp @@ -21,28 +21,36 @@ bool sp_version_from_string(const char *string, Inkscape::Version *version) if (!string) { return false; } - + try { std::stringstream ss; + + // Throw exception if error. + ss.exceptions(std::ios::failbit | std::ios::badbit); ss << string; ss >> version->_major; char tmp=0; ss >> tmp; ss >>version->_minor; + + // Don't throw exception if failbit gets set (empty string OK). + ss.exceptions(std::ios::goodbit); + getline(ss, version->_tail); return true; } catch(...) { version->_major = 0; version->_minor = 0; + version->_tail.clear(); return false; } } char *sp_version_to_string(Inkscape::Version version) { - return g_strdup_printf("%u.%u", version._major, version._minor); + return g_strdup_printf("%u.%u%s", version._major, version._minor, version._tail.c_str()); } bool sp_version_inside_range(Inkscape::Version version, diff --git a/src/version.h b/src/version.h index e17688b6d..f6221f6a6 100644 --- a/src/version.h +++ b/src/version.h @@ -13,6 +13,8 @@ #define SVG_VERSION "1.1" +#include + namespace Inkscape { class Version { @@ -43,6 +45,7 @@ public: unsigned int _major; unsigned int _minor; + std::string _tail; // Development version }; } -- cgit v1.2.3 From 2120743f09f27892a714a6cfdc162a59a4ad0f0a Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Wed, 8 Jun 2016 10:35:36 +0200 Subject: Remove unused svg-units variable. (bzr r14963) --- src/sp-namedview.cpp | 36 ++++++++++++++++++------------------ src/sp-namedview.h | 1 - 2 files changed, 18 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp index 06e068c42..850163720 100644 --- a/src/sp-namedview.cpp +++ b/src/sp-namedview.cpp @@ -59,25 +59,25 @@ static gboolean sp_str_to_bool(const gchar *str); static gboolean sp_nv_read_opacity(const gchar *str, guint32 *color); SPNamedView::SPNamedView() : SPObjectGroup(), snap_manager(this) { - this->zoom = 0; - this->guidecolor = 0; - this->guidehicolor = 0; - this->views.clear(); - this->borderlayer = 0; - this->page_size_units = NULL; - this->window_x = 0; - this->cy = 0; - this->window_y = 0; - this->svg_units = unit_table.getUnit("px"); // legacy behavior: if no viewbox present, default to 'px' units + + this->zoom = 0; + this->guidecolor = 0; + this->guidehicolor = 0; + this->views.clear(); + this->borderlayer = 0; + this->page_size_units = NULL; + this->window_x = 0; + this->cy = 0; + this->window_y = 0; this->display_units = NULL; - this->page_size_units = NULL; - this->pagecolor = 0; - this->cx = 0; - this->pageshadow = 0; - this->window_width = 0; - this->window_height = 0; - this->window_maximized = 0; - this->bordercolor = 0; + this->page_size_units = NULL; + this->pagecolor = 0; + this->cx = 0; + this->pageshadow = 0; + this->window_width = 0; + this->window_height = 0; + this->window_maximized = 0; + this->bordercolor = 0; this->editable = TRUE; this->showguides = TRUE; diff --git a/src/sp-namedview.h b/src/sp-namedview.h index ca85153b4..d8ac1a77e 100644 --- a/src/sp-namedview.h +++ b/src/sp-namedview.h @@ -64,7 +64,6 @@ public: std::vector grids; bool grids_visible; - Inkscape::Util::Unit const *svg_units; // Units used for the values in SVG Inkscape::Util::Unit const *display_units; // Units used for the UI (*not* the same as units of SVG coordinates) Inkscape::Util::Unit const *page_size_units; // Only used in "Custom size" part of Document Properties dialog -- cgit v1.2.3 From 1a5073c6fe3981ff0645490f28777d35bcb3b25b Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Wed, 8 Jun 2016 10:40:39 +0200 Subject: Really remove last of svg_units. (bzr r14964) --- src/sp-namedview.cpp | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'src') diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp index 850163720..616ec3921 100644 --- a/src/sp-namedview.cpp +++ b/src/sp-namedview.cpp @@ -261,16 +261,6 @@ void SPNamedView::build(SPDocument *document, Inkscape::XML::Node *repr) { // backwards compatibility with grid settings (pre 0.46) sp_namedview_generate_old_grid(this, document, repr); - - // If viewbox defined: try to calculate the SVG unit from document width and viewbox - if (document->getRoot()->viewBox_set) { - Inkscape::Util::Quantity svgwidth = document->getWidth(); - Geom::Rect viewbox = document->getRoot()->viewBox; - double factor = svgwidth.value(unit_table.primary(Inkscape::Util::UNIT_TYPE_LINEAR)) / viewbox.width(); - svg_units = unit_table.findUnit(factor, Inkscape::Util::UNIT_TYPE_LINEAR); - } else { // force the document units to be px - repr->setAttribute("inkscape:document-units", "px"); - } } void SPNamedView::release() { -- cgit v1.2.3 From 5401a129da2f319316221727fef5c516c3a72906 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Wed, 8 Jun 2016 11:16:29 +0200 Subject: Only update inkscape.version on successful file write. (bzr r14965) --- src/document.cpp | 5 ----- src/file.cpp | 16 +++++++++++++++- src/sp-root.cpp | 8 +++++--- 3 files changed, 20 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/document.cpp b/src/document.cpp index e9388893e..d8c3f1269 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -369,11 +369,6 @@ SPDocument *SPDocument::createDoc(Inkscape::XML::Document *rdoc, // Recursively build object tree document->root->invoke_build(document, rroot, false); - /* fixme: Not sure about this, but lets assume ::build updates */ - rroot->setAttribute("inkscape:version", Inkscape::version_string); - /* fixme: Again, I moved these here to allow version determining in ::build (Lauris) */ - - /* Eliminate obsolete sodipodi:docbase, for privacy reasons */ rroot->setAttribute("sodipodi:docbase", NULL); diff --git a/src/file.cpp b/src/file.cpp index 9d390908e..650ce5d0f 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -45,7 +45,7 @@ #include "helper/png-write.h" #include "id-clash.h" #include "inkscape.h" -#include "inkscape.h" +#include "inkscape-version.h" #include "ui/interface.h" #include "io/sys.h" #include "message.h" @@ -318,6 +318,12 @@ bool sp_file_open(const Glib::ustring &uri, // everyone who cares now has a reference, get rid of our`s doc->doUnref(); + SPRoot *root = doc->getRoot(); + + // This is the only place original values should be set. + root->original.inkscape = root->version.inkscape; + root->original.svg = root->version.svg; + // resize the window to match the document properties sp_namedview_window_from_document(desktop); sp_namedview_update_layers_from_document(desktop); @@ -669,6 +675,8 @@ file_save(Gtk::Window &parentWindow, SPDocument *doc, const Glib::ustring &uri, if (!doc || uri.size()<1) //Safety check return false; + Inkscape::Version save = doc->getRoot()->version.inkscape; + doc->getReprRoot()->setAttribute("inkscape:version", Inkscape::version_string); try { Inkscape::Extension::save(key, doc, uri.c_str(), false, @@ -681,6 +689,8 @@ file_save(Gtk::Window &parentWindow, SPDocument *doc, const Glib::ustring &uri, sp_ui_error_dialog(text); g_free(text); g_free(safeUri); + // Restore Inkscape version + doc->getReprRoot()->setAttribute("inkscape:version", sp_version_to_string( save )); return false; } catch (Inkscape::Extension::Output::file_read_only &e) { gchar *safeUri = Inkscape::IO::sanitizeString(uri.c_str()); @@ -689,6 +699,7 @@ file_save(Gtk::Window &parentWindow, SPDocument *doc, const Glib::ustring &uri, sp_ui_error_dialog(text); g_free(text); g_free(safeUri); + doc->getReprRoot()->setAttribute("inkscape:version", sp_version_to_string( save )); return false; } catch (Inkscape::Extension::Output::save_failed &e) { gchar *safeUri = Inkscape::IO::sanitizeString(uri.c_str()); @@ -697,14 +708,17 @@ file_save(Gtk::Window &parentWindow, SPDocument *doc, const Glib::ustring &uri, sp_ui_error_dialog(text); g_free(text); g_free(safeUri); + doc->getReprRoot()->setAttribute("inkscape:version", sp_version_to_string( save )); return false; } catch (Inkscape::Extension::Output::save_cancelled &e) { SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("Document not saved.")); + doc->getReprRoot()->setAttribute("inkscape:version", sp_version_to_string( save )); return false; } catch (Inkscape::Extension::Output::no_overwrite &e) { return sp_file_save_dialog(parentWindow, doc, save_method); } catch (...) { SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("Document not saved.")); + doc->getReprRoot()->setAttribute("inkscape:version", sp_version_to_string( save )); return false; } diff --git a/src/sp-root.cpp b/src/sp-root.cpp index 8bedec0a5..98eae2159 100644 --- a/src/sp-root.cpp +++ b/src/sp-root.cpp @@ -313,9 +313,11 @@ Inkscape::XML::Node *SPRoot::write(Inkscape::XML::Document *xml_doc, Inkscape::X repr = xml_doc->createElement("svg:svg"); } - if (flags & SP_OBJECT_WRITE_EXT) { - repr->setAttribute("inkscape:version", Inkscape::version_string); - } + /* Only update version string on successful write to file. This is handled by 'file_save()'. + * if (flags & SP_OBJECT_WRITE_EXT) { + * repr->setAttribute("inkscape:version", Inkscape::version_string); + * } + */ if (!repr->attribute("version")) { gchar *myversion = sp_version_to_string(this->version.svg); -- cgit v1.2.3 From 528228b2803595a29f618d84303de502eaff0674 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Fri, 10 Jun 2016 16:41:08 +0100 Subject: Rm unnecessary/incorrect post-build message Fixed bugs: - https://launchpad.net/bugs/1591251 (bzr r14970) --- src/CMakeLists.txt | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index df25728f4..cf5130317 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -513,17 +513,6 @@ add_library(inkscape_base SHARED ${inkscape_SRC} ${sp_SRC}) add_executable(inkscape ${main_SRC} ) add_executable(inkview inkview.cpp ) - - -if(UNIX) -# message after building. -add_custom_command( - TARGET inkscape - POST_BUILD MAIN_DEPENDENCY inkscape - COMMAND ${CMAKE_COMMAND} -E echo 'now run: \"make install\" to copy runtime files & scripts to ${CMAKE_INSTALL_PREFIX}' -) -endif() - add_dependencies(inkscape inkscape_version) if(WITH_DBUS) -- cgit v1.2.3 From 3079ce20475a82fa7dcf5c4f9b67d9c09cff427b Mon Sep 17 00:00:00 2001 From: h-h-h Date: Fri, 10 Jun 2016 23:23:58 +0200 Subject: Enabled using the context menu key additionally to the already working Shift+F10 key combination to show the context menu ("tool-base.cpp") (bzr r14971.1.1) --- src/ui/tools/tool-base.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index abac2c091..36fe26e76 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -683,6 +683,11 @@ bool ToolBase::root_handler(GdkEvent* event) { } break; + case GDK_KEY_Menu: + sp_event_root_menu_popup(desktop, NULL, event); + ret = TRUE; + break; + case GDK_KEY_F10: if (MOD__SHIFT_ONLY(event)) { sp_event_root_menu_popup(desktop, NULL, event); -- cgit v1.2.3 From 0a08d7714145c5fc355d086ed7d45dd285bd5d59 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 11 Jun 2016 13:51:02 +0200 Subject: fix-bugs #540591 #1287996 and #456503 related to undo in path parameters of LPE Fixed bugs: - https://launchpad.net/bugs/540591 - https://launchpad.net/bugs/1287996 - https://launchpad.net/bugs/456503 (bzr r14975) --- src/live_effects/effect.cpp | 1 + src/live_effects/parameter/path.cpp | 28 ++++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 732c67304..1868ca43b 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -714,6 +714,7 @@ Effect::getParameter(const char * key) { Glib::ustring stringkey(key); + if (param_vector.empty()) return NULL; std::vector::iterator it = param_vector.begin(); while (it != param_vector.end()) { Parameter * param = *it; diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp index 7ea1d465c..bed191e83 100644 --- a/src/live_effects/parameter/path.cpp +++ b/src/live_effects/parameter/path.cpp @@ -73,7 +73,21 @@ PathParam::PathParam( const Glib::ustring& label, const Glib::ustring& tip, PathParam::~PathParam() { remove_link(); - + using namespace Inkscape::UI; + SPDesktop *desktop = SP_ACTIVE_DESKTOP; + if (desktop) { + if (tools_isactive(desktop, TOOLS_NODES)) { + SPItem * item = SP_ACTIVE_DESKTOP->getSelection()->singleItem(); + if (item != NULL) { + Inkscape::UI::Tools::NodeTool *nt = static_cast(desktop->event_context); + std::set shapes; + ShapeRecord r; + r.item = item; + shapes.insert(r); + nt->_multipath->setItems(shapes); + } + } + } g_free(defvalue); } @@ -207,6 +221,9 @@ PathParam::param_newWidget() void PathParam::param_editOncanvas(SPItem *item, SPDesktop * dt) { + SPDocument *document = dt->getDocument(); + bool saved = DocumentUndo::getUndoSensitive(document); + DocumentUndo::setUndoSensitive(document, false); using namespace Inkscape::UI; // TODO remove the tools_switch atrocity. @@ -220,14 +237,20 @@ PathParam::param_editOncanvas(SPItem *item, SPDesktop * dt) r.role = SHAPE_ROLE_LPE_PARAM; r.edit_transform = item->i2dt_affine(); // TODO is it right? + r.edit_transform *= item->transform.inverse(); if (!href) { r.item = reinterpret_cast(param_effect->getLPEObj()); r.lpe_key = param_key; + Geom::PathVector stored_pv = _pathvector; + param_write_to_repr("M0,0 L1,0"); + const char *svgd = sp_svg_write_path(stored_pv); + param_write_to_repr(svgd); } else { r.item = ref.getObject(); } shapes.insert(r); nt->_multipath->setItems(shapes); + DocumentUndo::setUndoSensitive(document, saved); } void @@ -435,7 +458,8 @@ PathParam::paste_param_path(const char *svgd) SPItem * item = SP_ACTIVE_DESKTOP->getSelection()->singleItem(); if (item != NULL) { Geom::PathVector path_clipboard = sp_svg_read_pathv(svgd); - path_clipboard *= item->i2doc_affine().inverse(); + path_clipboard *= item->i2doc_affine().inverse() * item->transform; + path_clipboard *= Geom::Translate(path_clipboard.initialPoint() - _pathvector.initialPoint()).inverse(); svgd = sp_svg_write_path( path_clipboard ); } -- cgit v1.2.3 From 14a7a0151889e00ad60ebf6b613674e0c5f5b27e Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sat, 11 Jun 2016 15:05:53 +0200 Subject: Fix a typo that spawned a lot of "unused parameter" warnings when compiling (bzr r14976) --- src/style-internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/style-internal.h b/src/style-internal.h index 767552784..6cc8c6c4e 100644 --- a/src/style-internal.h +++ b/src/style-internal.h @@ -520,7 +520,7 @@ public: {} SPIEnumBits( Glib::ustring const &name, SPStyleEnum const *enums, unsigned value = 0, bool inherits = true ) : - SPIEnum( name, enums, value, inherit ) + SPIEnum( name, enums, value, inherits ) {} virtual ~SPIEnumBits() -- cgit v1.2.3 From 3b39f6fb0fac1eb0457de170a9af7b7ad629bc71 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sat, 11 Jun 2016 16:25:52 +0200 Subject: A little cleaning up of attributes. (bzr r14977) --- src/attributes-test.h | 105 ++++++++++++++++++++++++++------------------------ src/attributes.cpp | 30 +++++++++------ src/attributes.h | 31 ++++++++------- src/sp-item.cpp | 1 - 4 files changed, 92 insertions(+), 75 deletions(-) (limited to 'src') diff --git a/src/attributes-test.h b/src/attributes-test.h index b8d5d98a5..bfb67064b 100644 --- a/src/attributes-test.h +++ b/src/attributes-test.h @@ -104,21 +104,6 @@ struct {char const *attr; bool supported;} const all_attrs[] = { {"end", true}, {"exponent", true}, {"externalResourcesRequired", false}, - {"feBlend", false}, - {"feColorMatrix", false}, - {"feComponentTransfer", false}, - {"feComposite", false}, - {"feConvolveMatrix", false}, - {"feDiffuseLighting", false}, - {"feDisplacementMap", false}, - {"feFlood", false}, - {"feGaussianBlur", false}, - {"feImage", false}, - {"feMerge", false}, - {"feMorphology", false}, - {"feOffset", false}, - {"feSpecularLighting", false}, - {"feTile", false}, {"fill", true}, {"fill-opacity", true}, {"fill-rule", true}, @@ -361,55 +346,33 @@ struct {char const *attr; bool supported;} const all_attrs[] = { /* Extra attributes. */ {"id", true}, + {"sodipodi:docname", true}, + {"sodipodi:insensitive", true}, + {"sodipodi:type", true}, {"inkscape:collect", true}, {"inkscape:document-units", true}, {"inkscape:label", true}, - {"sodipodi:insensitive", true}, - {"sodipodi:nonprintable", true}, {"inkscape:groupmode", true}, - {"sodipodi:version", false}, {"inkscape:version", true}, {"inkscape:object-paths", true}, - {"inkscape:snap-perpendicular", true}, - {"inkscape:snap-tangential", true}, - {"inkscape:snap-path-clip", true}, - {"inkscape:snap-path-mask", true}, - {"inkscape:object-nodes", true}, - {"inkscape:bbox-paths", true}, - {"inkscape:bbox-nodes", true}, - {"inkscape:snap-page", true}, - {"inkscape:snap-global", true}, - {"inkscape:snap-bbox", true}, - {"inkscape:snap-nodes", true}, - {"inkscape:snap-others", true}, - {"inkscape:snap-center", true}, - {"inkscape:snap-smooth-nodes", true}, - {"inkscape:snap-midpoints", true}, - {"inkscape:snap-object-midpoints", true}, - {"inkscape:snap-text-baseline", true}, - {"inkscape:snap-bbox-edge-midpoints", true}, - {"inkscape:snap-bbox-midpoints", true}, - {"inkscape:snap-grids", true}, - {"inkscape:snap-to-guides", true}, - {"inkscape:snap-intersection-paths", true}, + {"inkscape:original-d", true}, {"inkscape:pageopacity", true}, {"inkscape:pageshadow", true}, {"inkscape:path-effect", true}, + // SPItem {"inkscape:transform-center-x", true}, {"inkscape:transform-center-y", true}, {"inkscape:highlight-color", true}, - // Namedview - {"inkscape:zoom", true}, - {"inkscape:cx", true}, - {"inkscape:cy", true}, - {"inkscape:window-width", true}, - {"inkscape:window-height", true}, - {"inkscape:window-x", true}, - {"inkscape:window-y", true}, - {"inkscape:window-maximized", true}, - {"inkscape:current-layer", true}, + + // Measure tool + {"inkscape:measure-start", true}, + {"inkscape:measure-end", true}, + + // Spray tool + {"inkscape:spray-origin", true}, + // Connector tool {"inkscape:connector-type", true}, {"inkscape:connection-start", true}, @@ -420,11 +383,13 @@ struct {char const *attr; bool supported;} const all_attrs[] = { {"inkscape:connector-curvature", true}, {"inkscape:connector-avoid", true}, {"inkscape:connector-spacing", true}, + // Ellipse, Spiral, Star {"sodipodi:cx", true}, {"sodipodi:cy", true}, {"sodipodi:rx", true}, {"sodipodi:ry", true}, + // Box tool {"inkscape:perspectiveID", true}, {"inkscape:corner0", true}, @@ -435,6 +400,7 @@ struct {char const *attr; bool supported;} const all_attrs[] = { {"inkscape:vp_y", true}, {"inkscape:vp_z", true}, {"inkscape:persp3d-origin", true}, + // Star tool {"sodipodi:start", true}, {"sodipodi:end", true}, @@ -517,8 +483,47 @@ struct {char const *attr; bool supported;} const all_attrs[] = { {"borderopacity", true}, {"pagecolor", true}, + {"inkscape:zoom", true}, + {"inkscape:cx", true}, + {"inkscape:cy", true}, + {"inkscape:window-width", true}, + {"inkscape:window-height", true}, + {"inkscape:window-x", true}, + {"inkscape:window-y", true}, + {"inkscape:window-maximized", true}, + {"inkscape:current-layer", true}, + {"inkscape:pagecheckerboard", true}, + /* SPGuide */ {"position", true}, + {"inkscape:color", true}, + {"inkscape:lockguides", true}, + {"inkscape:locked", true}, + + /* Snapping */ + {"inkscape:snap-perpendicular", true}, + {"inkscape:snap-tangential", true}, + {"inkscape:snap-path-clip", true}, + {"inkscape:snap-path-mask", true}, + {"inkscape:object-nodes", true}, + {"inkscape:bbox-paths", true}, + {"inkscape:bbox-nodes", true}, + {"inkscape:snap-page", true}, + {"inkscape:snap-global", true}, + {"inkscape:snap-bbox", true}, + {"inkscape:snap-nodes", true}, + {"inkscape:snap-others", true}, + {"inkscape:snap-from-guide", true}, + {"inkscape:snap-center", true}, + {"inkscape:snap-smooth-nodes", true}, + {"inkscape:snap-midpoints", true}, + {"inkscape:snap-object-midpoints", true}, + {"inkscape:snap-text-baseline", true}, + {"inkscape:snap-bbox-edge-midpoints", true}, + {"inkscape:snap-bbox-midpoints", true}, + {"inkscape:snap-grids", true}, + {"inkscape:snap-to-guides", true}, + {"inkscape:snap-intersection-paths", true}, /* SPTag */ {"inkscape:expanded", true} diff --git a/src/attributes.cpp b/src/attributes.cpp index 646c2ab0c..24c16d5fc 100644 --- a/src/attributes.cpp +++ b/src/attributes.cpp @@ -14,6 +14,7 @@ #include // g_assert() #include "attributes.h" +#include typedef struct { gint code; @@ -28,15 +29,24 @@ static SPStyleProp const props[] = { {SP_ATTR_INVALID, NULL}, /* SPObject */ {SP_ATTR_ID, "id"}, + {SP_ATTR_STYLE, "style"}, {SP_ATTR_INKSCAPE_COLLECT, "inkscape:collect"}, {SP_ATTR_INKSCAPE_LABEL, "inkscape:label"}, + /* SPRoot */ + {SP_ATTR_VERSION, "version"}, + {SP_ATTR_INKSCAPE_VERSION, "inkscape:version"}, + {SP_ATTR_WIDTH, "width"}, + {SP_ATTR_HEIGHT, "height"}, + {SP_ATTR_VIEWBOX, "viewBox"}, + {SP_ATTR_PRESERVEASPECTRATIO, "preserveAspectRatio"}, + {SP_ATTR_ONLOAD, "onload"}, + {SP_ATTR_SODIPODI_DOCNAME, "sodipodi:docname"}, /* SPItem */ {SP_ATTR_TRANSFORM, "transform"}, + {SP_ATTR_SODIPODI_TYPE, "sodipodi:type"}, {SP_ATTR_SODIPODI_INSENSITIVE, "sodipodi:insensitive"}, - {SP_ATTR_SODIPODI_NONPRINTABLE, "sodipodi:nonprintable"}, {SP_ATTR_CONNECTOR_AVOID, "inkscape:connector-avoid"}, {SP_ATTR_CONNECTION_POINTS, "inkscape:connection-points"}, - {SP_ATTR_STYLE, "style"}, {SP_ATTR_TRANSFORM_CENTER_X, "inkscape:transform-center-x"}, {SP_ATTR_TRANSFORM_CENTER_Y, "inkscape:transform-center-y"}, {SP_ATTR_INKSCAPE_PATH_EFFECT, "inkscape:path-effect"}, @@ -53,14 +63,6 @@ static SPStyleProp const props[] = { {SP_ATTR_TARGET, "target"}, {SP_ATTR_INKSCAPE_GROUPMODE, "inkscape:groupmode"}, {SP_ATTR_INKSCAPE_EXPANDED, "inkscape:expanded"}, - /* SPRoot */ - {SP_ATTR_VERSION, "version"}, - {SP_ATTR_WIDTH, "width"}, - {SP_ATTR_HEIGHT, "height"}, - {SP_ATTR_VIEWBOX, "viewBox"}, - {SP_ATTR_PRESERVEASPECTRATIO, "preserveAspectRatio"}, - {SP_ATTR_INKSCAPE_VERSION, "inkscape:version"}, - {SP_ATTR_ONLOAD, "onload"}, /* SPNamedView */ {SP_ATTR_VIEWONLY, "viewonly"}, {SP_ATTR_SHOWGUIDES, "showguides"}, @@ -99,6 +101,7 @@ static SPStyleProp const props[] = { {SP_ATTR_INKSCAPE_SNAP_BBOX, "inkscape:snap-bbox"}, {SP_ATTR_INKSCAPE_SNAP_NODE, "inkscape:snap-nodes"}, {SP_ATTR_INKSCAPE_SNAP_OTHERS, "inkscape:snap-others"}, + {SP_ATTR_INKSCAPE_SNAP_FROM_GUIDE, "inkscape:snap-from-guide"}, {SP_ATTR_INKSCAPE_SNAP_ROTATION_CENTER, "inkscape:snap-center"}, {SP_ATTR_INKSCAPE_SNAP_GRID, "inkscape:snap-grids"}, {SP_ATTR_INKSCAPE_SNAP_GUIDE, "inkscape:snap-to-guides"}, @@ -120,7 +123,6 @@ static SPStyleProp const props[] = { {SP_ATTR_INKSCAPE_DOCUMENT_UNITS, "inkscape:document-units"}, // This setting sets the Display units, *not* the units used in SVG {SP_ATTR_INKSCAPE_LOCKGUIDES, "inkscape:lockguides"}, {SP_ATTR_UNITS, "units"}, - {SP_ATTR_INKSCAPE_CONNECTOR_SPACING, "inkscape:connector-spacing"}, /* SPColorProfile */ {SP_ATTR_LOCAL, "local"}, {SP_ATTR_NAME, "name"}, @@ -130,6 +132,9 @@ static SPStyleProp const props[] = { {SP_ATTR_POSITION, "position"}, {SP_ATTR_INKSCAPE_COLOR, "inkscape:color"}, {SP_ATTR_INKSCAPE_LOCKED, "inkscape:locked"}, + /* Measure tool */ + {SP_ATTR_INKSCAPE_MEASURE_START, "inkscape:measure-start"}, + {SP_ATTR_INKSCAPE_MEASURE_END, "inkscape:measure-end"}, /* SPImage */ {SP_ATTR_X, "x"}, {SP_ATTR_Y, "y"}, @@ -139,6 +144,7 @@ static SPStyleProp const props[] = { /* (Note: XML representation of connectors may change in future.) */ {SP_ATTR_CONNECTOR_TYPE, "inkscape:connector-type"}, {SP_ATTR_CONNECTOR_CURVATURE, "inkscape:connector-curvature"}, + {SP_ATTR_INKSCAPE_CONNECTOR_SPACING, "inkscape:connector-spacing"}, {SP_ATTR_CONNECTION_START, "inkscape:connection-start"}, {SP_ATTR_CONNECTION_END, "inkscape:connection-end"}, {SP_ATTR_CONNECTION_START_POINT, "inkscape:connection-start-point"}, @@ -544,6 +550,8 @@ sp_attribute_lookup(gchar const *key) if(g_str_equal(const_cast(static_cast(props[i].name)), key)) return GPOINTER_TO_UINT(GINT_TO_POINTER(props[i].code)); } + // std::cerr << "sp_attribute_lookup: invalid attribute: " + // << (key?key:"Null") << std::endl; return SP_ATTR_INVALID; } diff --git a/src/attributes.h b/src/attributes.h index f5544d0a1..e82db5f2a 100644 --- a/src/attributes.h +++ b/src/attributes.h @@ -28,15 +28,24 @@ enum SPAttributeEnum { SP_ATTR_INVALID, ///< Must have value 0. /* SPObject */ SP_ATTR_ID, + SP_ATTR_STYLE, SP_ATTR_INKSCAPE_COLLECT, SP_ATTR_INKSCAPE_LABEL, + /* SPRoot Put these near top as the apply to the entire SVG */ + SP_ATTR_VERSION, + SP_ATTR_INKSCAPE_VERSION, + SP_ATTR_WIDTH, + SP_ATTR_HEIGHT, + SP_ATTR_VIEWBOX, + SP_ATTR_PRESERVEASPECTRATIO, + SP_ATTR_ONLOAD, + SP_ATTR_SODIPODI_DOCNAME, /* SPItem */ SP_ATTR_TRANSFORM, + SP_ATTR_SODIPODI_TYPE, SP_ATTR_SODIPODI_INSENSITIVE, - SP_ATTR_SODIPODI_NONPRINTABLE, SP_ATTR_CONNECTOR_AVOID, SP_ATTR_CONNECTION_POINTS, - SP_ATTR_STYLE, SP_ATTR_TRANSFORM_CENTER_X, SP_ATTR_TRANSFORM_CENTER_Y, SP_ATTR_INKSCAPE_PATH_EFFECT, @@ -54,14 +63,6 @@ enum SPAttributeEnum { /* SPGroup */ SP_ATTR_INKSCAPE_GROUPMODE, SP_ATTR_INKSCAPE_EXPANDED, - /* SPRoot */ - SP_ATTR_VERSION, - SP_ATTR_WIDTH, - SP_ATTR_HEIGHT, - SP_ATTR_VIEWBOX, - SP_ATTR_PRESERVEASPECTRATIO, - SP_ATTR_INKSCAPE_VERSION, - SP_ATTR_ONLOAD, /* SPNamedView */ SP_ATTR_VIEWONLY, SP_ATTR_SHOWGUIDES, @@ -100,7 +101,7 @@ enum SPAttributeEnum { SP_ATTR_INKSCAPE_SNAP_BBOX, SP_ATTR_INKSCAPE_SNAP_NODE, SP_ATTR_INKSCAPE_SNAP_OTHERS, - //SP_ATTR_INKSCAPE_SNAP_FROM_GUIDE, + SP_ATTR_INKSCAPE_SNAP_FROM_GUIDE, SP_ATTR_INKSCAPE_SNAP_ROTATION_CENTER, SP_ATTR_INKSCAPE_SNAP_GRID, SP_ATTR_INKSCAPE_SNAP_GUIDE, @@ -122,7 +123,6 @@ enum SPAttributeEnum { SP_ATTR_INKSCAPE_DOCUMENT_UNITS, SP_ATTR_INKSCAPE_LOCKGUIDES, SP_ATTR_UNITS, - SP_ATTR_INKSCAPE_CONNECTOR_SPACING, /* SPColorProfile */ SP_ATTR_LOCAL, SP_ATTR_NAME, @@ -132,7 +132,10 @@ enum SPAttributeEnum { SP_ATTR_POSITION, SP_ATTR_INKSCAPE_COLOR, SP_ATTR_INKSCAPE_LOCKED, - /* SPImage */ + /* Measure tool */ + SP_ATTR_INKSCAPE_MEASURE_START, + SP_ATTR_INKSCAPE_MEASURE_END, + /* SPImage, SPRect, etc. */ SP_ATTR_X, SP_ATTR_Y, /* SPPath */ @@ -140,6 +143,7 @@ enum SPAttributeEnum { SP_ATTR_INKSCAPE_ORIGINAL_D, SP_ATTR_CONNECTOR_TYPE, SP_ATTR_CONNECTOR_CURVATURE, + SP_ATTR_INKSCAPE_CONNECTOR_SPACING, SP_ATTR_CONNECTION_START, SP_ATTR_CONNECTION_END, SP_ATTR_CONNECTION_START_POINT, @@ -334,6 +338,7 @@ enum SPAttributeEnum { SP_ATTR_RESTART, SP_ATTR_REPEATCOUNT, SP_ATTR_REPEATDUR, + /* Interpolating animations */ SP_ATTR_CALCMODE, //SP_ATTR_VALUES, diff --git a/src/sp-item.cpp b/src/sp-item.cpp index af81194c2..9fd6e8ecc 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -399,7 +399,6 @@ void SPItem::build(SPDocument *document, Inkscape::XML::Node *repr) { object->readAttr( "clip-path" ); object->readAttr( "mask" ); object->readAttr( "sodipodi:insensitive" ); - object->readAttr( "sodipodi:nonprintable" ); object->readAttr( "inkscape:transform-center-x" ); object->readAttr( "inkscape:transform-center-y" ); object->readAttr( "inkscape:connector-avoid" ); -- cgit v1.2.3 From 64b7a2d79f1e160e9e4ee723fd89f8aadd177924 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sat, 11 Jun 2016 19:20:13 +0200 Subject: Clean up includes after r14955 Fixed bugs: - https://launchpad.net/bugs/1589300 (bzr r14978) --- src/extension/param/bool.cpp | 1 - src/extension/param/float.cpp | 1 - src/extension/param/int.cpp | 1 - src/extension/param/parameter.cpp | 3 ++- 4 files changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/extension/param/bool.cpp b/src/extension/param/bool.cpp index 87364d80f..d64f798ba 100644 --- a/src/extension/param/bool.cpp +++ b/src/extension/param/bool.cpp @@ -19,7 +19,6 @@ #include "../extension.h" #include "bool.h" #include "preferences.h" -#include namespace Inkscape { namespace Extension { diff --git a/src/extension/param/float.cpp b/src/extension/param/float.cpp index 4e3cbfedc..dff7cbf46 100644 --- a/src/extension/param/float.cpp +++ b/src/extension/param/float.cpp @@ -20,7 +20,6 @@ #include "extension/extension.h" #include "preferences.h" #include "float.h" -#include namespace Inkscape { namespace Extension { diff --git a/src/extension/param/int.cpp b/src/extension/param/int.cpp index 605aab5ad..dda801282 100644 --- a/src/extension/param/int.cpp +++ b/src/extension/param/int.cpp @@ -20,7 +20,6 @@ #include "extension/extension.h" #include "preferences.h" #include "int.h" -#include namespace Inkscape { namespace Extension { diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index 27d9bdf9b..e4a614667 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -20,7 +20,6 @@ #endif #include -#include #include "ui/widget/color-notebook.h" #include @@ -41,6 +40,8 @@ #include "radiobutton.h" #include "string.h" +#include + namespace Inkscape { namespace Extension { -- cgit v1.2.3 From 381c20f462265052cd320a26fb779b1d07a7dffc Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sat, 11 Jun 2016 19:25:23 +0200 Subject: Extensions: Use underscored variants of parameters / attribute names in internal extensions where translation via gettext is desired. Fixed bugs: - https://launchpad.net/bugs/1591230 (bzr r14979) --- .../internal/bitmap/adaptiveThreshold.cpp | 6 +- src/extension/internal/bitmap/addNoise.cpp | 2 +- src/extension/internal/bitmap/blur.cpp | 4 +- src/extension/internal/bitmap/channel.cpp | 2 +- src/extension/internal/bitmap/charcoal.cpp | 4 +- src/extension/internal/bitmap/colorize.cpp | 2 +- src/extension/internal/bitmap/contrast.cpp | 2 +- src/extension/internal/bitmap/crop.cpp | 8 +- src/extension/internal/bitmap/cycleColormap.cpp | 2 +- src/extension/internal/bitmap/edge.cpp | 2 +- src/extension/internal/bitmap/emboss.cpp | 4 +- src/extension/internal/bitmap/gaussianBlur.cpp | 4 +- src/extension/internal/bitmap/implode.cpp | 2 +- src/extension/internal/bitmap/level.cpp | 6 +- src/extension/internal/bitmap/levelChannel.cpp | 8 +- src/extension/internal/bitmap/medianFilter.cpp | 2 +- src/extension/internal/bitmap/modulate.cpp | 6 +- src/extension/internal/bitmap/oilPaint.cpp | 2 +- src/extension/internal/bitmap/opacity.cpp | 2 +- src/extension/internal/bitmap/raise.cpp | 6 +- src/extension/internal/bitmap/reduceNoise.cpp | 2 +- src/extension/internal/bitmap/sample.cpp | 4 +- src/extension/internal/bitmap/shade.cpp | 6 +- src/extension/internal/bitmap/sharpen.cpp | 4 +- src/extension/internal/bitmap/solarize.cpp | 2 +- src/extension/internal/bitmap/spread.cpp | 2 +- src/extension/internal/bitmap/swirl.cpp | 2 +- src/extension/internal/bitmap/threshold.cpp | 2 +- src/extension/internal/bitmap/unsharpmask.cpp | 8 +- src/extension/internal/bitmap/wave.cpp | 4 +- src/extension/internal/bluredge.cpp | 4 +- src/extension/internal/cairo-ps-out.cpp | 40 +++--- src/extension/internal/cairo-renderer-pdf-out.cpp | 20 +-- src/extension/internal/emf-inout.cpp | 22 +-- src/extension/internal/filter/bevels.h | 28 ++-- src/extension/internal/filter/blurs.h | 36 ++--- src/extension/internal/filter/bumps.h | 96 ++++++------- src/extension/internal/filter/color.h | 148 ++++++++++----------- src/extension/internal/filter/distort.h | 36 ++--- src/extension/internal/filter/image.h | 6 +- src/extension/internal/filter/morphology.h | 44 +++--- src/extension/internal/filter/overlays.h | 18 +-- src/extension/internal/filter/paint.h | 148 ++++++++++----------- src/extension/internal/filter/protrusions.h | 2 +- src/extension/internal/filter/shadows.h | 12 +- src/extension/internal/filter/textures.h | 24 ++-- src/extension/internal/filter/transparency.h | 34 ++--- src/extension/internal/gdkpixbuf-input.cpp | 2 +- src/extension/internal/grid.cpp | 10 +- src/extension/internal/wmf-inout.cpp | 18 +-- src/extension/prefdialog.cpp | 2 +- 51 files changed, 431 insertions(+), 431 deletions(-) (limited to 'src') diff --git a/src/extension/internal/bitmap/adaptiveThreshold.cpp b/src/extension/internal/bitmap/adaptiveThreshold.cpp index 9c9d6796b..3d7475cb3 100644 --- a/src/extension/internal/bitmap/adaptiveThreshold.cpp +++ b/src/extension/internal/bitmap/adaptiveThreshold.cpp @@ -38,9 +38,9 @@ AdaptiveThreshold::init(void) "\n" "" N_("Adaptive Threshold") "\n" "org.inkscape.effect.bitmap.adaptiveThreshold\n" - "5\n" - "5\n" - "0\n" + "5\n" + "5\n" + "0\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/bitmap/addNoise.cpp b/src/extension/internal/bitmap/addNoise.cpp index 0322dec0c..02bb877b7 100644 --- a/src/extension/internal/bitmap/addNoise.cpp +++ b/src/extension/internal/bitmap/addNoise.cpp @@ -44,7 +44,7 @@ AddNoise::init(void) "\n" "" N_("Add Noise") "\n" "org.inkscape.effect.bitmap.addNoise\n" - "\n" + "\n" "<_item value='Uniform Noise'>" N_("Uniform Noise") "\n" "<_item value='Gaussian Noise'>" N_("Gaussian Noise") "\n" "<_item value='Multiplicative Gaussian Noise'>" N_("Multiplicative Gaussian Noise") "\n" diff --git a/src/extension/internal/bitmap/blur.cpp b/src/extension/internal/bitmap/blur.cpp index cc44994ec..37a56b8a9 100644 --- a/src/extension/internal/bitmap/blur.cpp +++ b/src/extension/internal/bitmap/blur.cpp @@ -37,8 +37,8 @@ Blur::init(void) "\n" "" N_("Blur") "\n" "org.inkscape.effect.bitmap.blur\n" - "1\n" - "0.5\n" + "1\n" + "0.5\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/bitmap/channel.cpp b/src/extension/internal/bitmap/channel.cpp index 372e7456b..57ef0421b 100644 --- a/src/extension/internal/bitmap/channel.cpp +++ b/src/extension/internal/bitmap/channel.cpp @@ -47,7 +47,7 @@ Channel::init(void) "\n" "" N_("Channel") "\n" "org.inkscape.effect.bitmap.channel\n" - "\n" + "\n" "<_item value='Red Channel'>" N_("Red Channel") "\n" "<_item value='Green Channel'>" N_("Green Channel") "\n" "<_item value='Blue Channel'>" N_("Blue Channel") "\n" diff --git a/src/extension/internal/bitmap/charcoal.cpp b/src/extension/internal/bitmap/charcoal.cpp index f647f8711..2cfd741d1 100644 --- a/src/extension/internal/bitmap/charcoal.cpp +++ b/src/extension/internal/bitmap/charcoal.cpp @@ -37,8 +37,8 @@ Charcoal::init(void) "\n" "" N_("Charcoal") "\n" "org.inkscape.effect.bitmap.charcoal\n" - "1\n" - "0.5\n" + "1\n" + "0.5\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/bitmap/colorize.cpp b/src/extension/internal/bitmap/colorize.cpp index 0b3b95420..1c4b8a696 100644 --- a/src/extension/internal/bitmap/colorize.cpp +++ b/src/extension/internal/bitmap/colorize.cpp @@ -49,7 +49,7 @@ Colorize::init(void) "\n" "" N_("Colorize") "\n" "org.inkscape.effect.bitmap.colorize\n" - "0\n" + "0\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/bitmap/contrast.cpp b/src/extension/internal/bitmap/contrast.cpp index c527536d9..a3be77808 100644 --- a/src/extension/internal/bitmap/contrast.cpp +++ b/src/extension/internal/bitmap/contrast.cpp @@ -39,7 +39,7 @@ Contrast::init(void) "\n" "" N_("Contrast") "\n" "org.inkscape.effect.bitmap.contrast\n" - "0\n" + "0\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/bitmap/crop.cpp b/src/extension/internal/bitmap/crop.cpp index 02d92668b..8f6c503ca 100644 --- a/src/extension/internal/bitmap/crop.cpp +++ b/src/extension/internal/bitmap/crop.cpp @@ -65,10 +65,10 @@ Crop::init(void) "\n" "" N_("Crop") "\n" "org.inkscape.effect.bitmap.crop\n" - "0\n" - "0\n" - "0\n" - "0\n" + "0\n" + "0\n" + "0\n" + "0\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/bitmap/cycleColormap.cpp b/src/extension/internal/bitmap/cycleColormap.cpp index 349b6d9f5..8d55087a6 100644 --- a/src/extension/internal/bitmap/cycleColormap.cpp +++ b/src/extension/internal/bitmap/cycleColormap.cpp @@ -36,7 +36,7 @@ CycleColormap::init(void) "\n" "" N_("Cycle Colormap") "\n" "org.inkscape.effect.bitmap.cycleColormap\n" - "180\n" + "180\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/bitmap/edge.cpp b/src/extension/internal/bitmap/edge.cpp index 2d165331f..486ce0e4e 100644 --- a/src/extension/internal/bitmap/edge.cpp +++ b/src/extension/internal/bitmap/edge.cpp @@ -36,7 +36,7 @@ Edge::init(void) "\n" "" N_("Edge") "\n" "org.inkscape.effect.bitmap.edge\n" - "0\n" + "0\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/bitmap/emboss.cpp b/src/extension/internal/bitmap/emboss.cpp index 634c71a98..9518cf320 100644 --- a/src/extension/internal/bitmap/emboss.cpp +++ b/src/extension/internal/bitmap/emboss.cpp @@ -37,8 +37,8 @@ Emboss::init(void) "\n" "" N_("Emboss") "\n" "org.inkscape.effect.bitmap.emboss\n" - "1.0\n" - "0.5\n" + "1.0\n" + "0.5\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/bitmap/gaussianBlur.cpp b/src/extension/internal/bitmap/gaussianBlur.cpp index 7d93ef66a..d68cd59bc 100644 --- a/src/extension/internal/bitmap/gaussianBlur.cpp +++ b/src/extension/internal/bitmap/gaussianBlur.cpp @@ -37,8 +37,8 @@ GaussianBlur::init(void) "\n" "" N_("Gaussian Blur") "\n" "org.inkscape.effect.bitmap.gaussianBlur\n" - "5.0\n" - "5.0\n" + "5.0\n" + "5.0\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/bitmap/implode.cpp b/src/extension/internal/bitmap/implode.cpp index 15f92f5f6..c24fb7bf5 100644 --- a/src/extension/internal/bitmap/implode.cpp +++ b/src/extension/internal/bitmap/implode.cpp @@ -36,7 +36,7 @@ Implode::init(void) "\n" "" N_("Implode") "\n" "org.inkscape.effect.bitmap.implode\n" - "10\n" + "10\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/bitmap/level.cpp b/src/extension/internal/bitmap/level.cpp index 9c266eb11..168328e8f 100644 --- a/src/extension/internal/bitmap/level.cpp +++ b/src/extension/internal/bitmap/level.cpp @@ -40,9 +40,9 @@ Level::init(void) "\n" "" N_("Level") "\n" "org.inkscape.effect.bitmap.level\n" - "0\n" - "100\n" - "1\n" + "0\n" + "100\n" + "1\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/bitmap/levelChannel.cpp b/src/extension/internal/bitmap/levelChannel.cpp index 3e39657c3..d5c636059 100644 --- a/src/extension/internal/bitmap/levelChannel.cpp +++ b/src/extension/internal/bitmap/levelChannel.cpp @@ -51,7 +51,7 @@ LevelChannel::init(void) "\n" "" N_("Level (with Channel)") "\n" "org.inkscape.effect.bitmap.levelChannel\n" - "\n" + "\n" "<_item value='Red Channel'>" N_("Red Channel") "\n" "<_item value='Green Channel'>" N_("Green Channel") "\n" "<_item value='Blue Channel'>" N_("Blue Channel") "\n" @@ -62,9 +62,9 @@ LevelChannel::init(void) "<_item value='Opacity Channel'>" N_("Opacity Channel") "\n" "<_item value='Matte Channel'>" N_("Matte Channel") "\n" "\n" - "0.0\n" - "100.0\n" - "1.0\n" + "0.0\n" + "100.0\n" + "1.0\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/bitmap/medianFilter.cpp b/src/extension/internal/bitmap/medianFilter.cpp index 44ff9e543..64837850d 100644 --- a/src/extension/internal/bitmap/medianFilter.cpp +++ b/src/extension/internal/bitmap/medianFilter.cpp @@ -36,7 +36,7 @@ MedianFilter::init(void) "\n" "" N_("Median") "\n" "org.inkscape.effect.bitmap.medianFilter\n" - "0\n" + "0\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/bitmap/modulate.cpp b/src/extension/internal/bitmap/modulate.cpp index d123a5c15..3b3a2495c 100644 --- a/src/extension/internal/bitmap/modulate.cpp +++ b/src/extension/internal/bitmap/modulate.cpp @@ -39,9 +39,9 @@ Modulate::init(void) "\n" "" N_("HSB Adjust") "\n" "org.inkscape.effect.bitmap.modulate\n" - "0\n" - "0\n" - "0\n" + "0\n" + "0\n" + "0\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/bitmap/oilPaint.cpp b/src/extension/internal/bitmap/oilPaint.cpp index 5377ab2b1..88c85a590 100644 --- a/src/extension/internal/bitmap/oilPaint.cpp +++ b/src/extension/internal/bitmap/oilPaint.cpp @@ -36,7 +36,7 @@ OilPaint::init(void) "\n" "" N_("Oil Paint") "\n" "org.inkscape.effect.bitmap.oilPaint\n" - "3\n" + "3\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/bitmap/opacity.cpp b/src/extension/internal/bitmap/opacity.cpp index f9b4bbc27..a25e99543 100644 --- a/src/extension/internal/bitmap/opacity.cpp +++ b/src/extension/internal/bitmap/opacity.cpp @@ -37,7 +37,7 @@ Opacity::init(void) "\n" "" N_("Opacity") "\n" "org.inkscape.effect.bitmap.opacity\n" - "80.0\n" + "80.0\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/bitmap/raise.cpp b/src/extension/internal/bitmap/raise.cpp index 9ca832c30..e85cc747a 100644 --- a/src/extension/internal/bitmap/raise.cpp +++ b/src/extension/internal/bitmap/raise.cpp @@ -39,9 +39,9 @@ Raise::init(void) "\n" "" N_("Raise") "\n" "org.inkscape.effect.bitmap.raise\n" - "6\n" - "6\n" - "0\n" + "6\n" + "6\n" + "0\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/bitmap/reduceNoise.cpp b/src/extension/internal/bitmap/reduceNoise.cpp index db227ec41..b0d8b9c2d 100644 --- a/src/extension/internal/bitmap/reduceNoise.cpp +++ b/src/extension/internal/bitmap/reduceNoise.cpp @@ -39,7 +39,7 @@ ReduceNoise::init(void) "\n" "" N_("Reduce Noise") "\n" "org.inkscape.effect.bitmap.reduceNoise\n" - "-1\n" + "-1\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/bitmap/sample.cpp b/src/extension/internal/bitmap/sample.cpp index 706ae1d5b..081303b73 100644 --- a/src/extension/internal/bitmap/sample.cpp +++ b/src/extension/internal/bitmap/sample.cpp @@ -38,8 +38,8 @@ Sample::init(void) "\n" "" N_("Resample") "\n" "org.inkscape.effect.bitmap.sample\n" - "100\n" - "100\n" + "100\n" + "100\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/bitmap/shade.cpp b/src/extension/internal/bitmap/shade.cpp index de7c9d669..927a3a578 100644 --- a/src/extension/internal/bitmap/shade.cpp +++ b/src/extension/internal/bitmap/shade.cpp @@ -39,9 +39,9 @@ Shade::init(void) "\n" "" N_("Shade") "\n" "org.inkscape.effect.bitmap.shade\n" - "30\n" - "30\n" - "false\n" + "30\n" + "30\n" + "false\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/bitmap/sharpen.cpp b/src/extension/internal/bitmap/sharpen.cpp index 89181abad..d397d46c8 100644 --- a/src/extension/internal/bitmap/sharpen.cpp +++ b/src/extension/internal/bitmap/sharpen.cpp @@ -37,8 +37,8 @@ Sharpen::init(void) "\n" "" N_("Sharpen") "\n" "org.inkscape.effect.bitmap.sharpen\n" - "1.0\n" - "0.5\n" + "1.0\n" + "0.5\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/bitmap/solarize.cpp b/src/extension/internal/bitmap/solarize.cpp index d333d2ae8..5f8cdd17c 100644 --- a/src/extension/internal/bitmap/solarize.cpp +++ b/src/extension/internal/bitmap/solarize.cpp @@ -38,7 +38,7 @@ Solarize::init(void) "\n" "" N_("Solarize") "\n" "org.inkscape.effect.bitmap.solarize\n" - "50\n" + "50\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/bitmap/spread.cpp b/src/extension/internal/bitmap/spread.cpp index 3e9110dd7..e38e2a927 100644 --- a/src/extension/internal/bitmap/spread.cpp +++ b/src/extension/internal/bitmap/spread.cpp @@ -36,7 +36,7 @@ Spread::init(void) "\n" "" N_("Dither") "\n" "org.inkscape.effect.bitmap.spread\n" - "3\n" + "3\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/bitmap/swirl.cpp b/src/extension/internal/bitmap/swirl.cpp index 1f2776031..98efa6238 100644 --- a/src/extension/internal/bitmap/swirl.cpp +++ b/src/extension/internal/bitmap/swirl.cpp @@ -36,7 +36,7 @@ Swirl::init(void) "\n" "" N_("Swirl") "\n" "org.inkscape.effect.bitmap.swirl\n" - "30\n" + "30\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/bitmap/threshold.cpp b/src/extension/internal/bitmap/threshold.cpp index 0db0f7749..9f10b2c42 100644 --- a/src/extension/internal/bitmap/threshold.cpp +++ b/src/extension/internal/bitmap/threshold.cpp @@ -37,7 +37,7 @@ Threshold::init(void) // TRANSLATORS: see http://docs.gimp.org/en/gimp-tool-threshold.html "" N_("Threshold") "\n" "org.inkscape.effect.bitmap.threshold\n" - "\n" + "\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/bitmap/unsharpmask.cpp b/src/extension/internal/bitmap/unsharpmask.cpp index 222feae8d..c5a7e9291 100644 --- a/src/extension/internal/bitmap/unsharpmask.cpp +++ b/src/extension/internal/bitmap/unsharpmask.cpp @@ -40,10 +40,10 @@ Unsharpmask::init(void) "\n" "" N_("Unsharp Mask") "\n" "org.inkscape.effect.bitmap.unsharpmask\n" - "5.0\n" - "5.0\n" - "50.0\n" - "5.0\n" + "5.0\n" + "5.0\n" + "50.0\n" + "5.0\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/bitmap/wave.cpp b/src/extension/internal/bitmap/wave.cpp index 158ae7e64..1ccaa1d5e 100644 --- a/src/extension/internal/bitmap/wave.cpp +++ b/src/extension/internal/bitmap/wave.cpp @@ -37,8 +37,8 @@ Wave::init(void) "\n" "" N_("Wave") "\n" "org.inkscape.effect.bitmap.wave\n" - "25\n" - "150\n" + "25\n" + "150\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/bluredge.cpp b/src/extension/internal/bluredge.cpp index 0e3aa98ce..4a04e3c33 100644 --- a/src/extension/internal/bluredge.cpp +++ b/src/extension/internal/bluredge.cpp @@ -131,8 +131,8 @@ BlurEdge::init (void) "\n" "" N_("Inset/Outset Halo") "\n" "org.inkscape.effect.bluredge\n" - "1.0\n" - "11\n" + "1.0\n" + "11\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/cairo-ps-out.cpp b/src/extension/internal/cairo-ps-out.cpp index 5dc412301..e8f47e79e 100644 --- a/src/extension/internal/cairo-ps-out.cpp +++ b/src/extension/internal/cairo-ps-out.cpp @@ -326,23 +326,23 @@ CairoPsOutput::init (void) "\n" "" N_("PostScript") "\n" "" SP_MODULE_KEY_PRINT_CAIRO_PS "\n" - "\n" + "\n" "<_item value='PS3'>" N_("PostScript level 3") "\n" "<_item value='PS2'>" N_("PostScript level 2") "\n" "\n" - "\n" - "\n" - "\n" - "\n" + "\n" + "<_option value=\"embed\">" N_("Embed fonts") "\n" + "<_option value=\"paths\">" N_("Convert text to paths") "\n" + "<_option value=\"LaTeX\">" N_("Omit text in PDF and create LaTeX file") "\n" "\n" - "true\n" - "96\n" - "\n" + "true\n" + "96\n" + "\n" "<_option value=\"page\">" N_("Use document's page size") "" "<_option value=\"drawing\">" N_("Use exported object's size") "" "" - "0\n" - "\n" + "0\n" + "\n" "\n" ".ps\n" "image/x-postscript\n" @@ -368,23 +368,23 @@ CairoEpsOutput::init (void) "\n" "" N_("Encapsulated PostScript") "\n" "" SP_MODULE_KEY_PRINT_CAIRO_EPS "\n" - "\n" + "\n" "<_item value='PS3'>" N_("PostScript level 3") "\n" "<_item value='PS2'>" N_("PostScript level 2") "\n" "\n" - "\n" - "\n" - "\n" - "\n" + "\n" + "<_option value=\"embed\">" N_("Embed fonts") "\n" + "<_option value=\"paths\">" N_("Convert text to paths") "\n" + "<_option value=\"LaTeX\">" N_("Omit text in PDF and create LaTeX file") "\n" "\n" - "true\n" - "96\n" - "\n" + "true\n" + "96\n" + "\n" "<_option value=\"page\">" N_("Use document's page size") "" "<_option value=\"drawing\">" N_("Use exported object's size") "" "" - "0\n" - "\n" + "0\n" + "\n" "\n" ".eps\n" "image/x-e-postscript\n" diff --git a/src/extension/internal/cairo-renderer-pdf-out.cpp b/src/extension/internal/cairo-renderer-pdf-out.cpp index e5c9406c9..5576676b2 100644 --- a/src/extension/internal/cairo-renderer-pdf-out.cpp +++ b/src/extension/internal/cairo-renderer-pdf-out.cpp @@ -241,25 +241,25 @@ CairoRendererPdfOutput::init (void) "\n" "Portable Document Format\n" "org.inkscape.output.pdf.cairorenderer\n" - "\n" + "\n" #if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 10, 0)) "<_item value='PDF-1.5'>" N_("PDF 1.5") "\n" #endif "<_item value='PDF-1.4'>" N_("PDF 1.4") "\n" "\n" - "\n" - "\n" - "\n" - "\n" + "\n" + "<_option value=\"embed\">" N_("Embed fonts") "\n" + "<_option value=\"paths\">" N_("Convert text to paths") "\n" + "<_option value=\"LaTeX\">" N_("Omit text in PDF and create LaTeX file") "\n" "\n" - "true\n" - "96\n" - "\n" + "true\n" + "96\n" + "\n" "<_option value=\"page\">" N_("Use document's page size") "" "<_option value=\"drawing\">" N_("Use exported object's size") "" "" - "0\n" - "\n" + "0\n" + "\n" "\n" ".pdf\n" "application/pdf\n" diff --git a/src/extension/internal/emf-inout.cpp b/src/extension/internal/emf-inout.cpp index 13520c40b..12751c5ec 100644 --- a/src/extension/internal/emf-inout.cpp +++ b/src/extension/internal/emf-inout.cpp @@ -3614,17 +3614,17 @@ Emf::init (void) "\n" "" N_("EMF Output") "\n" "org.inkscape.output.emf\n" - "true\n" - "true\n" - "true\n" - "true\n" - "false\n" - "false\n" - "false\n" - "false\n" - "false\n" - "false\n" - "false\n" + "true\n" + "true\n" + "true\n" + "true\n" + "false\n" + "false\n" + "false\n" + "false\n" + "false\n" + "false\n" + "false\n" "\n" ".emf\n" "image/x-emf\n" diff --git a/src/extension/internal/filter/bevels.h b/src/extension/internal/filter/bevels.h index ea9d537ad..68e94ad3d 100644 --- a/src/extension/internal/filter/bevels.h +++ b/src/extension/internal/filter/bevels.h @@ -52,10 +52,10 @@ public: "\n" "" N_("Diffuse Light") "\n" "org.inkscape.effect.filter.DiffuseLight\n" - "6\n" - "25\n" - "235\n" - "-1\n" + "6\n" + "25\n" + "235\n" + "-1\n" "\n" "all\n" "\n" @@ -132,11 +132,11 @@ public: "\n" "" N_("Matte Jelly") "\n" "org.inkscape.effect.filter.MatteJelly\n" - "7\n" - "0.9\n" - "60\n" - "225\n" - "-1\n" + "7\n" + "0.9\n" + "60\n" + "225\n" + "-1\n" "\n" "all\n" "\n" @@ -216,11 +216,11 @@ public: "\n" "" N_("Specular Light") "\n" "org.inkscape.effect.filter.SpecularLight\n" - "6\n" - "1\n" - "45\n" - "235\n" - "-1\n" + "6\n" + "1\n" + "45\n" + "235\n" + "-1\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/filter/blurs.h b/src/extension/internal/filter/blurs.h index fe1b9c930..77581ed96 100644 --- a/src/extension/internal/filter/blurs.h +++ b/src/extension/internal/filter/blurs.h @@ -53,9 +53,9 @@ public: "\n" "" N_("Blur") "\n" "org.inkscape.effect.filter.Blur\n" - "2\n" - "2\n" - "False\n" + "2\n" + "2\n" + "False\n" "\n" "all\n" "\n" @@ -124,7 +124,7 @@ public: "\n" "" N_("Clean Edges") "\n" "org.inkscape.effect.filter.CleanEdges\n" - "0.4\n" + "0.4\n" "\n" "all\n" "\n" @@ -184,11 +184,11 @@ public: "\n" "" N_("Cross Blur") "\n" "org.inkscape.effect.filter.CrossBlur\n" - "0\n" - "0\n" - "5\n" - "5\n" - "\n" + "0\n" + "0\n" + "5\n" + "5\n" + "\n" "<_item value=\"darken\">" N_("Darken") "\n" "<_item value=\"screen\">" N_("Screen") "\n" "<_item value=\"multiply\">" N_("Multiply") "\n" @@ -259,7 +259,7 @@ public: "\n" "" N_("Feather") "\n" "org.inkscape.effect.filter.Feather\n" - "5\n" + "5\n" "\n" "all\n" "\n" @@ -326,22 +326,22 @@ public: "org.inkscape.effect.filter.ImageBlur\n" "\n" "\n" - "3\n" - "3\n" - "6\n" - "2\n" - "1\n" + "3\n" + "3\n" + "6\n" + "2\n" + "1\n" "\n" "\n" - "-1\n" - "\n" + "-1\n" + "\n" "<_item value=\"normal\">" N_("Normal") "\n" "<_item value=\"darken\">" N_("Darken") "\n" "<_item value=\"screen\">" N_("Screen") "\n" "<_item value=\"multiply\">" N_("Multiply") "\n" "<_item value=\"lighten\">" N_("Lighten") "\n" "\n" - "false\n" + "false\n" "\n" "\n" "\n" diff --git a/src/extension/internal/filter/bumps.h b/src/extension/internal/filter/bumps.h index b59b1ef50..cbda5ea35 100644 --- a/src/extension/internal/filter/bumps.h +++ b/src/extension/internal/filter/bumps.h @@ -81,52 +81,52 @@ public: "org.inkscape.effect.filter.Bump\n" "\n" "\n" - "0.01\n" - "0.01\n" - "0\n" + "0.01\n" + "0.01\n" + "0\n" "<_param name=\"sourceHeader\" type=\"description\" appearance=\"header\">" N_("Bump source") "\n" - "0\n" - "0\n" - "0\n" - "false\n" + "0\n" + "0\n" + "0\n" + "false\n" "\n" "\n" - "\n" + "\n" "<_item value=\"specular\">" N_("Specular") "\n" "<_item value=\"diffuse\">" N_("Diffuse") "\n" "\n" - "5\n" - "1\n" - "15\n" - "-1\n" + "5\n" + "1\n" + "15\n" + "-1\n" "\n" "\n" - "\n" + "\n" "<_item value=\"distant\">" N_("Distant") "\n" "<_item value=\"point\">" N_("Point") "\n" "<_item value=\"spot\">" N_("Spot") "\n" "\n" "<_param name=\"distantHeader\" type=\"description\" appearance=\"header\">" N_("Distant light options") "\n" - "225\n" - "45\n" + "225\n" + "45\n" "<_param name=\"pointHeader\" type=\"description\" appearance=\"header\">" N_("Point light options") "\n" - "526\n" - "372\n" - "150\n" + "526\n" + "372\n" + "150\n" "<_param name=\"spotHeader\" type=\"description\" appearance=\"header\">" N_("Spot light options") "\n" - "526\n" - "372\n" - "150\n" - "0\n" - "0\n" - "-1000\n" - "1\n" - "50\n" + "526\n" + "372\n" + "150\n" + "0\n" + "0\n" + "-1000\n" + "1\n" + "50\n" "\n" "\n" - "-987158017\n" - "false\n" - "\n" + "-987158017\n" + "false\n" + "\n" "<_item value=\"normal\">" N_("Normal") "\n" "<_item value=\"darken\">" N_("Darken") "\n" "<_item value=\"screen\">" N_("Screen") "\n" @@ -310,35 +310,35 @@ public: "org.inkscape.effect.filter.WaxBump\n" "\n" "\n" - "1.5\n" - "1\n" - "1\n" + "1.5\n" + "1\n" + "1\n" "<_param name=\"sourceHeader\" type=\"description\" appearance=\"header\">" N_("Bump source") "\n" - "0\n" - "0\n" - "0\n" - "\n" + "0\n" + "0\n" + "0\n" + "\n" "<_item value=\"flood1\">" N_("Color") "\n" "<_item value=\"SourceGraphic\">" N_("Image") "\n" "<_item value=\"blur1\">" N_("Blurred image") "\n" "\n" - "0\n" + "0\n" "\n" "\n" - "-1\n" - "5\n" - "1.4\n" - "35\n" - "225\n" - "60\n" - "\n" + "-1\n" + "5\n" + "1.4\n" + "35\n" + "225\n" + "60\n" + "\n" "<_item value=\"screen\">" N_("Screen") "\n" "<_item value=\"normal\">" N_("Normal") "\n" "<_item value=\"darken\">" N_("Darken") "\n" "<_item value=\"multiply\">" N_("Multiply") "\n" "<_item value=\"lighten\">" N_("Lighten") "\n" "\n" - "\n" + "\n" "<_item value=\"screen\">" N_("Screen") "\n" "<_item value=\"normal\">" N_("Normal") "\n" "<_item value=\"darken\">" N_("Darken") "\n" @@ -347,9 +347,9 @@ public: "\n" "\n" "\n" - "-520083713\n" - "false\n" - "\n" + "-520083713\n" + "false\n" + "\n" "<_item value=\"atop\">" N_("Atop") "\n" "<_item value=\"in\">" N_("In") "\n" "\n" diff --git a/src/extension/internal/filter/color.h b/src/extension/internal/filter/color.h index b9c76615c..a6b777d20 100644 --- a/src/extension/internal/filter/color.h +++ b/src/extension/internal/filter/color.h @@ -72,10 +72,10 @@ public: "\n" "" N_("Brilliance") "\n" "org.inkscape.effect.filter.Brilliance\n" - "2\n" - "0.5\n" - "0\n" - "false\n" + "2\n" + "0.5\n" + "0\n" + "false\n" "\n" "all\n" "\n" @@ -154,15 +154,15 @@ public: "org.inkscape.effect.filter.ChannelPaint\n" "\n" "\n" - "1\n" - "-1\n" - "0.5\n" - "0.5\n" - "1\n" - "false\n" + "1\n" + "-1\n" + "0.5\n" + "0.5\n" + "1\n" + "false\n" "\n" "\n" - "16777215\n" + "16777215\n" "\n" "\n" "\n" @@ -255,7 +255,7 @@ public: "org.inkscape.effect.filter.ColorBlindness\n" "\n" "\n" - "\n" + "\n" "<_item value=\"0.618 0.32 0.062 0 0 0.163 0.775 0.062 0 0 0.163 0.32 0.516 0 0 0 0 0 1 0 \">" N_("Rod monochromacy (atypical achromatopsia)") "\n" "<_item value=\"0.299 0.587 0.114 0 0 0.299 0.587 0.114 0 0 0.299 0.587 0.114 0 0 0 0 0 1 0 \">" N_("Cone monochromacy (typical achromatopsia)") "\n" "<_item value=\"0.8 0.2 0 0 0 0.2583 0.74167 0 0 0 0 0.14167 0.85833 0 0 0 0 0 1 0 \">" N_("Green weak (deuteranomaly)") "\n" @@ -328,8 +328,8 @@ public: "\n" "" N_("Color Shift") "\n" "org.inkscape.effect.filter.ColorShift\n" - "330\n" - "0.6\n" + "330\n" + "0.6\n" "\n" "all\n" "\n" @@ -393,17 +393,17 @@ public: "org.inkscape.effect.filter.Colorize\n" "\n" "\n" - "0\n" - "1\n" - "false\n" - "\n" + "0\n" + "1\n" + "false\n" + "\n" "<_item value=\"multiply\">" N_("Multiply") "\n" "<_item value=\"normal\">" N_("Normal") "\n" "<_item value=\"screen\">" N_("Screen") "\n" "<_item value=\"lighten\">" N_("Lighten") "\n" "<_item value=\"darken\">" N_("Darken") "\n" "\n" - "\n" + "\n" "<_item value=\"screen\">" N_("Screen") "\n" "<_item value=\"multiply\">" N_("Multiply") "\n" "<_item value=\"normal\">" N_("Normal") "\n" @@ -412,7 +412,7 @@ public: "\n" "\n" "\n" - "-1639776001\n" + "-1639776001\n" "\n" "\n" "\n" @@ -498,7 +498,7 @@ public: "\n" "" N_("Component Transfer") "\n" "org.inkscape.effect.filter.ComponentTransfer\n" - "\n" + "\n" "<_item value=\"identity\">" N_("Identity") "\n" "<_item value=\"table\">" N_("Table") "\n" "<_item value=\"discrete\">" N_("Discrete") "\n" @@ -585,8 +585,8 @@ public: "org.inkscape.effect.filter.Duochrome\n" "\n" "\n" - "0\n" - "\n" + "0\n" + "\n" "<_item value=\"none\">" N_("No swap") "\n" "<_item value=\"full\">" N_("Color and alpha") "\n" "<_item value=\"color\">" N_("Color only") "\n" @@ -594,10 +594,10 @@ public: "\n" "\n" "\n" - "1364325887\n" + "1364325887\n" "\n" "\n" - "-65281\n" + "-65281\n" "\n" "\n" "\n" @@ -708,7 +708,7 @@ public: "\n" "" N_("Extract Channel") "\n" "org.inkscape.effect.filter.ExtractChannel\n" - "\n" + "\n" "<_item value=\"r\">" N_("Red") "\n" "<_item value=\"g\">" N_("Green") "\n" "<_item value=\"b\">" N_("Blue") "\n" @@ -716,12 +716,12 @@ public: "<_item value=\"m\">" N_("Magenta") "\n" "<_item value=\"y\">" N_("Yellow") "\n" "\n" - "\n" + "\n" "<_item value=\"multiply\">" N_("Multiply") "\n" "<_item value=\"normal\">" N_("Normal") "\n" "<_item value=\"screen\">" N_("Screen") "\n" "\n" - "false\n" + "false\n" "\n" "all\n" "\n" @@ -814,8 +814,8 @@ public: "\n" "" N_("Fade to Black or White") "\n" "org.inkscape.effect.filter.FadeToBW\n" - "1\n" - "\n" + "1\n" + "\n" "<_item value=\"black\">" N_("Black") "\n" "<_item value=\"white\">" N_("White") "\n" "\n" @@ -893,11 +893,11 @@ public: "\n" "" N_("Greyscale") "\n" "org.inkscape.effect.filter.Greyscale\n" - "0.21\n" - "0.72\n" - "0.072\n" - "0\n" - "false\n" + "0.21\n" + "0.72\n" + "0.072\n" + "0\n" + "false\n" "\n" "all\n" "\n" @@ -979,16 +979,16 @@ public: "\n" "" N_("Invert") "\n" "org.inkscape.effect.filter.Invert\n" - "\n" + "\n" "<_item value=\"0\">" N_("No inversion") "\n" "<_item value=\"1\">" N_("Red and blue") "\n" "<_item value=\"2\">" N_("Red and green") "\n" "<_item value=\"3\">" N_("Green and blue") "\n" "\n" - "0\n" - "false\n" - "false\n" - "false\n" + "0\n" + "false\n" + "false\n" + "false\n" "\n" "all\n" "\n" @@ -1114,9 +1114,9 @@ public: "\n" "" N_("Lighting") "\n" "org.inkscape.effect.filter.Lighting\n" - "1\n" - "1\n" - "0\n" + "1\n" + "1\n" + "0\n" "\n" "all\n" "\n" @@ -1185,8 +1185,8 @@ public: "\n" "" N_("Lightness-Contrast") "\n" "org.inkscape.effect.filter.LightnessContrast\n" - "0\n" - "0\n" + "0\n" + "0\n" "\n" "all\n" "\n" @@ -1267,17 +1267,17 @@ public: "\n" "\n" "<_param name=\"redOffset\" type=\"description\" appearance=\"header\">" N_("Red offset") "\n" - "-6\n" - "-6\n" + "-6\n" + "-6\n" "<_param name=\"greenOffset\" type=\"description\" appearance=\"header\">" N_("Green offset") "\n" - "6\n" - "7\n" + "6\n" + "7\n" "<_param name=\"redOffset\" type=\"description\" appearance=\"header\">" N_("Blue offset") "\n" - "1\n" - "-16\n" + "1\n" + "-16\n" "\n" "\n" - "255\n" + "255\n" "\n" "\n" "\n" @@ -1379,17 +1379,17 @@ public: "\n" "\n" "<_param name=\"cyanOffset\" type=\"description\" appearance=\"header\">" N_("Cyan offset") "\n" - "-6\n" - "-6\n" + "-6\n" + "-6\n" "<_param name=\"magentaOffset\" type=\"description\" appearance=\"header\">" N_("Magenta offset") "\n" - "6\n" - "7\n" + "6\n" + "7\n" "<_param name=\"yellowOffset\" type=\"description\" appearance=\"header\">" N_("Yellow offset") "\n" - "1\n" - "-16\n" + "1\n" + "-16\n" "\n" "\n" - "-1\n" + "-1\n" "\n" "\n" "\n" @@ -1482,15 +1482,15 @@ public: "\n" "" N_("Quadritone fantasy") "\n" "org.inkscape.effect.filter.Quadritone\n" - "280\n" - "100\n" - "\n" + "280\n" + "100\n" + "\n" "<_item value=\"normal\">" N_("Normal") "\n" "<_item value=\"multiply\">" N_("Multiply") "\n" "<_item value=\"screen\">" N_("Screen") "\n" "\n" - "0\n" - "\n" + "0\n" + "\n" "<_item value=\"normal\">" N_("Normal") "\n" "<_item value=\"screen\">" N_("Screen") "\n" "<_item value=\"multiply\">" N_("Multiply") "\n" @@ -1568,8 +1568,8 @@ public: "\n" "" N_("Solarize") "\n" "org.inkscape.effect.filter.Solarize\n" - "0\n" - "\n" + "0\n" + "\n" "<_item value=\"solarize\">" N_("Solarize") "\n" "<_item value=\"moonarize\">" N_("Moonarize") "\n" "\n" @@ -1657,31 +1657,31 @@ public: "org.inkscape.effect.filter.Tritone\n" "\n" "\n" - "\n" + "\n" "<_item value=\"normal\">" N_("Normal") "\n" "<_item value=\"enhue\">" N_("Enhance hue") "\n" "<_item value=\"phospho\">" N_("Phosphorescence") "\n" "<_item value=\"phosphoB\">" N_("Colored nights") "\n" "<_item value=\"htb\">" N_("Hue to background") "\n" "\n" - "\n" + "\n" "<_item value=\"lighten\">" N_("Lighten") "\n" "<_item value=\"screen\">" N_("Screen") "\n" "<_item value=\"multiply\">" N_("Multiply") "\n" "<_item value=\"darken\">" N_("Darken") "\n" "\n" - "0.01\n" - "\n" + "0.01\n" + "\n" "<_item value=\"normal\">" N_("Normal") "\n" "<_item value=\"multiply\">" N_("Multiply") "\n" "<_item value=\"darken\">" N_("Darken") "\n" "\n" - "0\n" - "1\n" + "0\n" + "1\n" "\n" "\n" - "0\n" - "-73203457\n" + "0\n" + "-73203457\n" "\n" "\n" "\n" diff --git a/src/extension/internal/filter/distort.h b/src/extension/internal/filter/distort.h index 586d34226..56aab51f5 100644 --- a/src/extension/internal/filter/distort.h +++ b/src/extension/internal/filter/distort.h @@ -66,29 +66,29 @@ public: "\n" "" N_("Felt Feather") "\n" "org.inkscape.effect.filter.FeltFeather\n" - "\n" + "\n" "<_item value=\"in\">" N_("In") "\n" "<_item value=\"out\">" N_("Out") "\n" "\n" - "15\n" - "15\n" - "1\n" - "0\n" - "\n" + "15\n" + "15\n" + "1\n" + "0\n" + "\n" "<_item value=\"atop\">" N_("Normal") "\n" "<_item value=\"over\">" N_("Wide") "\n" "<_item value=\"in\">" N_("Narrow") "\n" "<_item value=\"xor\">" N_("No fill") "\n" "\n" - "\n" + "\n" "<_item value=\"fractalNoise\">" N_("Fractal noise") "\n" "<_item value=\"turbulence\">" N_("Turbulence") "\n" "\n" - "5\n" - "5\n" - "3\n" - "0\n" - "30\n" + "5\n" + "5\n" + "3\n" + "0\n" + "30\n" "\n" "all\n" "\n" @@ -189,15 +189,15 @@ public: "\n" "" N_("Roughen") "\n" "org.inkscape.effect.filter.Roughen\n" - "\n" + "\n" "<_item value=\"fractalNoise\">" N_("Fractal noise") "\n" "<_item value=\"turbulence\">" N_("Turbulence") "\n" "\n" - "1.3\n" - "1.3\n" - "5\n" - "0\n" - "6.6\n" + "1.3\n" + "1.3\n" + "5\n" + "0\n" + "6.6\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/filter/image.h b/src/extension/internal/filter/image.h index 00cd2cf21..868588f80 100644 --- a/src/extension/internal/filter/image.h +++ b/src/extension/internal/filter/image.h @@ -48,13 +48,13 @@ public: "\n" "" N_("Edge Detect") "\n" "org.inkscape.effect.filter.EdgeDetect\n" - "\n" + "\n" "<_item value=\"all\">" N_("All") "\n" "<_item value=\"vertical\">" N_("Vertical lines") "\n" "<_item value=\"horizontal\">" N_("Horizontal lines") "\n" "\n" - "1.0\n" - "false\n" + "1.0\n" + "false\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/filter/morphology.h b/src/extension/internal/filter/morphology.h index 7e10884a1..e1785f7d3 100644 --- a/src/extension/internal/filter/morphology.h +++ b/src/extension/internal/filter/morphology.h @@ -57,17 +57,17 @@ public: "\n" "" N_("Cross-smooth") "\n" "org.inkscape.effect.filter.crosssmooth\n" - "\n" + "\n" "<_item value=\"in\">" N_("Inner") "\n" "<_item value=\"over\">" N_("Outer") "\n" "<_item value=\"xor\">" N_("Open") "\n" "\n" - "10\n" - "1\n" - "10\n" - "1\n" - "1\n" - "false\n" + "10\n" + "1\n" + "10\n" + "1\n" + "1\n" + "false\n" "\n" "all\n" @@ -167,33 +167,33 @@ public: "org.inkscape.effect.filter.Outline\n" "\n" "\n" - "false\n" - "false\n" - "\n" + "false\n" + "false\n" + "\n" "<_item value=\"over\">" N_("Over") "\n" "<_item value=\"in\">" N_("In") "\n" "<_item value=\"out\">" N_("Out") "\n" "<_item value=\"atop\">" N_("Atop") "\n" "<_item value=\"xor\">" N_("XOR") "\n" "\n" - "\n" + "\n" "<_item value=\"inside\">" N_("Inside") "\n" "<_item value=\"outside\">" N_("Outside") "\n" "<_item value=\"overlayed\">" N_("Overlayed") "\n" "\n" - "4\n" - "100\n" - "1\n" - "0.5\n" - "50\n" - "5\n" - "1\n" - "false\n" + "4\n" + "100\n" + "1\n" + "0.5\n" + "50\n" + "5\n" + "1\n" + "false\n" "\n" "\n" - "255\n" - "1\n" - "1\n" + "255\n" + "1\n" + "1\n" "\n" "\n" "\n" diff --git a/src/extension/internal/filter/overlays.h b/src/extension/internal/filter/overlays.h index 1ca745166..f6c0509c8 100644 --- a/src/extension/internal/filter/overlays.h +++ b/src/extension/internal/filter/overlays.h @@ -57,20 +57,20 @@ public: "org.inkscape.effect.filter.NoiseFill\n" "\n" "\n" - "\n" + "\n" "<_item value=\"fractalNoise\">" N_("Fractal noise") "\n" "<_item value=\"turbulence\">" N_("Turbulence") "\n" "\n" - "20\n" - "40\n" - "5\n" - "0\n" - "3\n" - "1\n" - "false\n" + "20\n" + "40\n" + "5\n" + "0\n" + "3\n" + "1\n" + "false\n" "\n" "\n" - "354957823\n" + "354957823\n" "\n" "\n" "\n" diff --git a/src/extension/internal/filter/paint.h b/src/extension/internal/filter/paint.h index 941177f39..43f4b6c90 100644 --- a/src/extension/internal/filter/paint.h +++ b/src/extension/internal/filter/paint.h @@ -72,32 +72,32 @@ public: "org.inkscape.effect.filter.Chromolitho\n" "\n" "\n" - "true\n" - "\n" + "true\n" + "\n" "<_item value=\"darken\">Darken\n" "<_item value=\"normal\">Normal\n" "<_item value=\"multiply\">Multiply\n" "<_item value=\"screen\">Screen\n" "<_item value=\"lighten\">Lighten\n" "\n" - "false\n" - "false\n" - "false\n" - "0\n" - "1\n" - "10\n" - "1\n" + "false\n" + "false\n" + "false\n" + "0\n" + "1\n" + "10\n" + "1\n" "\n" "\n" - "true\n" - "1000\n" - "1000\n" - "1\n" - "0\n" - "1\n" - "0\n" - "true\n" - "\n" + "true\n" + "1000\n" + "1000\n" + "1\n" + "0\n" + "1\n" + "0\n" + "true\n" + "\n" "<_item value=\"normal\">Normal\n" "<_item value=\"multiply\">Multiply\n" "<_item value=\"screen\">Screen\n" @@ -231,12 +231,12 @@ public: "\n" "" N_("Cross Engraving") "\n" "org.inkscape.effect.filter.CrossEngraving\n" - "30\n" - "1\n" - "0\n" - "0.5\n" - "4\n" - "false\n" + "30\n" + "1\n" + "0\n" + "0.5\n" + "4\n" + "false\n" "\n" "all\n" "\n" @@ -333,27 +333,27 @@ public: "\n" "\n" "<_param name=\"simplifyheader\" type=\"description\" appearance=\"header\">" N_("Simplify") "\n" - "0.6\n" - "10\n" - "0\n" - "false\n" + "0.6\n" + "10\n" + "0\n" + "false\n" "<_param name=\"smoothheader\" type=\"description\" appearance=\"header\">" N_("Smoothness") "\n" - "0.6\n" - "6\n" - "2\n" + "0.6\n" + "6\n" + "2\n" "<_param name=\"meltheader\" type=\"description\" appearance=\"header\">" N_("Melt") "\n" - "1\n" - "6\n" - "2\n" + "1\n" + "6\n" + "2\n" "\n" "\n" - "-1515870721\n" - "false\n" + "-1515870721\n" + "false\n" "\n" "\n" - "589505535\n" - "false\n" - "0\n" + "589505535\n" + "false\n" + "0\n" "\n" "\n" "\n" @@ -493,13 +493,13 @@ public: "\n" "" N_("Electrize") "\n" "org.inkscape.effect.filter.Electrize\n" - "2.0\n" - "\n" + "2.0\n" + "\n" "<_item value=\"table\">" N_("Table") "\n" "<_item value=\"discrete\">" N_("Discrete") "\n" "\n" - "3\n" - "false\n" + "3\n" + "false\n" "\n" "all\n" "\n" @@ -583,14 +583,14 @@ public: "\n" "" N_("Neon Draw") "\n" "org.inkscape.effect.filter.NeonDraw\n" - "\n" + "\n" "<_item value=\"table\">" N_("Smoothed") "\n" "<_item value=\"discrete\">" N_("Contrasted") "\n" "\n" - "3\n" - "3\n" - "1\n" - "\n" + "3\n" + "3\n" + "1\n" + "\n" "<_item value=\"normal\">Normal\n" "<_item value=\"multiply\">Multiply\n" "<_item value=\"screen\">Screen\n" @@ -688,34 +688,34 @@ public: "org.inkscape.effect.filter.PointEngraving\n" "\n" "\n" - "\n" + "\n" "<_item value=\"fractalNoise\">" N_("Fractal noise") "\n" "<_item value=\"turbulence\">" N_("Turbulence") "\n" "\n" - "100\n" - "100\n" - "1\n" - "0\n" - "45\n" - "\n" + "100\n" + "100\n" + "1\n" + "0\n" + "45\n" + "\n" "<_item value=\"multiply\">" N_("Multiply") "\n" "<_item value=\"normal\">" N_("Normal") "\n" "<_item value=\"screen\">" N_("Screen") "\n" "<_item value=\"lighten\">" N_("Lighten") "\n" "<_item value=\"darken\">" N_("Darken") "\n" "\n" - "2.5\n" - "1.3\n" - "0\n" - "0.5\n" + "2.5\n" + "1.3\n" + "0\n" + "0.5\n" "\n" "\n" - "-1\n" - "false\n" + "-1\n" + "false\n" "\n" "\n" - "1666789119\n" - "false\n" + "1666789119\n" + "false\n" "\n" "\n" "\n" @@ -849,27 +849,27 @@ public: "\n" "" N_("Poster Paint") "\n" "org.inkscape.effect.filter.Posterize\n" - "\n" + "\n" "<_item value=\"normal\">Normal\n" "<_item value=\"dented\">Dented\n" "\n" - "\n" + "\n" "<_item value=\"discrete\">" N_("Poster") "\n" "<_item value=\"table\">" N_("Painting") "\n" "\n" - "5\n" - "\n" + "5\n" + "\n" "<_item value=\"lighten\">Lighten\n" "<_item value=\"normal\">Normal\n" "<_item value=\"darken\">Darken\n" "<_item value=\"multiply\">Multiply\n" "<_item value=\"screen\">Screen\n" "\n" - "4.0\n" - "0.5\n" - "1.00\n" - "1.00\n" - "false\n" + "4.0\n" + "0.5\n" + "1.00\n" + "1.00\n" + "false\n" "\n" "all\n" "\n" @@ -972,8 +972,8 @@ public: "\n" "" N_("Posterize Basic") "\n" "org.inkscape.effect.filter.PosterizeBasic\n" - "5\n" - "4.0\n" + "5\n" + "4.0\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/filter/protrusions.h b/src/extension/internal/filter/protrusions.h index 965a1bdc5..ad75d8896 100644 --- a/src/extension/internal/filter/protrusions.h +++ b/src/extension/internal/filter/protrusions.h @@ -47,7 +47,7 @@ public: "\n" "" N_("Snow crest") "\n" "org.inkscape.effect.filter.snow\n" - "3.5\n" + "3.5\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/filter/shadows.h b/src/extension/internal/filter/shadows.h index 0d54950bf..e69e05669 100644 --- a/src/extension/internal/filter/shadows.h +++ b/src/extension/internal/filter/shadows.h @@ -58,10 +58,10 @@ public: "org.inkscape.effect.filter.ColorDropShadow\n" "\n" "\n" - "3.0\n" - "6.0\n" - "6.0\n" - "\n" + "3.0\n" + "6.0\n" + "6.0\n" + "\n" "<_item value=\"outer\">" N_("Outer") "\n" "<_item value=\"inner\">" N_("Inner") "\n" "<_item value=\"outercut\">" N_("Outer cutout") "\n" @@ -70,8 +70,8 @@ public: "\n" "\n" "\n" - "127\n" - "false\n" + "127\n" + "false\n" "\n" "\n" "\n" diff --git a/src/extension/internal/filter/textures.h b/src/extension/internal/filter/textures.h index 32eef6054..a2584c627 100644 --- a/src/extension/internal/filter/textures.h +++ b/src/extension/internal/filter/textures.h @@ -61,18 +61,18 @@ public: "\n" "" N_("Ink Blot") "\n" "org.inkscape.effect.filter.InkBlot\n" - "\n" + "\n" "<_item value=\"fractalNoise\">Fractal noise\n" "<_item value=\"turbulence\">Turbulence\n" "\n" - "4\n" - "3\n" - "0\n" - "10\n" - "10\n" - "50\n" - "5\n" - "\n" + "4\n" + "3\n" + "0\n" + "10\n" + "10\n" + "50\n" + "5\n" + "\n" "<_item value=\"over\">" N_("Wide") "\n" "<_item value=\"atop\">" N_("Normal") "\n" "<_item value=\"in\">" N_("Narrow") "\n" @@ -81,9 +81,9 @@ public: "<_item value=\"arithmetic\">" N_("Custom") "\n" "\n" "<_param name=\"customHeader\" type=\"description\" appearance=\"header\">" N_("Custom stroke options") "\n" - "1.5\n" - "-0.25\n" - "0.5\n" + "1.5\n" + "-0.25\n" + "0.5\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/filter/transparency.h b/src/extension/internal/filter/transparency.h index dcbae26b5..da89498bb 100644 --- a/src/extension/internal/filter/transparency.h +++ b/src/extension/internal/filter/transparency.h @@ -52,11 +52,11 @@ public: "\n" "" N_("Blend") "\n" "org.inkscape.effect.filter.Blend\n" - "\n" + "\n" "<_item value=\"BackgroundImage\">" N_("Background") "\n" "<_item value=\"SourceGraphic\">" N_("Image") "\n" "\n" - "\n" + "\n" "<_item value=\"multiply\">" N_("Multiply") "\n" "<_item value=\"normal\">" N_("Normal") "\n" "<_item value=\"screen\">" N_("Screen") "\n" @@ -129,11 +129,11 @@ public: "\n" "" N_("Channel Transparency") "\n" "org.inkscape.effect.filter.ChannelTransparency\n" - "-1\n" - "0.5\n" - "0.5\n" - "1\n" - "false\n" + "-1\n" + "0.5\n" + "0.5\n" + "1\n" + "false\n" "\n" "all\n" "\n" @@ -204,10 +204,10 @@ public: "\n" "" N_("Light Eraser") "\n" "org.inkscape.effect.filter.LightEraser\n" - "50\n" - "100\n" - "1\n" - "false\n" + "50\n" + "100\n" + "1\n" + "false\n" "\n" "all\n" "\n" @@ -278,9 +278,9 @@ public: "\n" "" N_("Opacity") "\n" "org.inkscape.effect.filter.Opacity\n" - "5\n" - "1\n" - "1\n" + "5\n" + "1\n" + "1\n" "\n" "all\n" "\n" @@ -340,9 +340,9 @@ public: "\n" "" N_("Silhouette") "\n" "org.inkscape.effect.filter.Silhouette\n" - "0.01\n" - "false\n" - "255\n" + "0.01\n" + "false\n" + "255\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/gdkpixbuf-input.cpp b/src/extension/internal/gdkpixbuf-input.cpp index c15e28854..b30c67a4d 100644 --- a/src/extension/internal/gdkpixbuf-input.cpp +++ b/src/extension/internal/gdkpixbuf-input.cpp @@ -208,7 +208,7 @@ GdkpixbufInput::init(void) "<_option value='optimizeSpeed' >" N_("Blocky (optimizeSpeed)") "\n" "\n" - "false\n" + "false\n" "\n" ".%s\n" "%s\n" diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp index e6938b9e2..c766bd828 100644 --- a/src/extension/internal/grid.cpp +++ b/src/extension/internal/grid.cpp @@ -198,11 +198,11 @@ Grid::init (void) "\n" "" N_("Grid") "\n" "org.inkscape.effect.grid\n" - "1.0\n" - "10.0\n" - "10.0\n" - "0.0\n" - "0.0\n" + "1.0\n" + "10.0\n" + "10.0\n" + "0.0\n" + "0.0\n" "\n" "all\n" "\n" diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp index b8b0c73de..c7226a58a 100644 --- a/src/extension/internal/wmf-inout.cpp +++ b/src/extension/internal/wmf-inout.cpp @@ -3193,15 +3193,15 @@ Wmf::init (void) "\n" "" N_("WMF Output") "\n" "org.inkscape.output.wmf\n" - "true\n" - "true\n" - "true\n" - "true\n" - "false\n" - "false\n" - "false\n" - "false\n" - "false\n" + "true\n" + "true\n" + "true\n" + "true\n" + "false\n" + "false\n" + "false\n" + "false\n" + "false\n" "\n" ".wmf\n" "image/x-wmf\n" diff --git a/src/extension/prefdialog.cpp b/src/extension/prefdialog.cpp index 0ea15a5cd..2521dc1de 100644 --- a/src/extension/prefdialog.cpp +++ b/src/extension/prefdialog.cpp @@ -273,7 +273,7 @@ PrefDialog::on_response (int signal) { #include "internal/clear-n_.h" -const char * PrefDialog::live_param_xml = "false"; +const char * PrefDialog::live_param_xml = "false"; }; }; /* namespace Inkscape, Extension */ -- cgit v1.2.3 From 6ed2673499ca548767bb7d2edb453a228ece86fd Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sun, 12 Jun 2016 10:25:42 +0200 Subject: Optionally sort attributes and properties into a canonical order. Useful for comparing different versions of an SVG file. (bzr r14980) --- src/CMakeLists.txt | 2 + src/Makefile_insert | 1 + src/attribute-sort-util.cpp | 206 ++++++++++++++++++++++++++++++++++++++++++++ src/attribute-sort-util.h | 62 +++++++++++++ src/attributes.cpp | 91 ++++++++++--------- src/attributes.h | 101 ++++++++++++---------- src/preferences-skeleton.h | 3 +- src/xml/repr-io.cpp | 5 ++ 8 files changed, 383 insertions(+), 88 deletions(-) create mode 100644 src/attribute-sort-util.cpp create mode 100644 src/attribute-sort-util.h (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cf5130317..66f16b7fb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,6 +10,7 @@ set(sp_SRC attribute-rel-css.cpp attribute-rel-svg.cpp attribute-rel-util.cpp + attribute-sort-util.cpp sp-anchor.cpp sp-clippath.cpp sp-conn-end-pair.cpp @@ -92,6 +93,7 @@ set(sp_SRC attribute-rel-css.h attribute-rel-svg.h attribute-rel-util.h + attribute-sort-util.h sp-anchor.h sp-clippath.h sp-conn-end-pair.h diff --git a/src/Makefile_insert b/src/Makefile_insert index b9723ac42..55fde4dd2 100644 --- a/src/Makefile_insert +++ b/src/Makefile_insert @@ -8,6 +8,7 @@ ink_common_sources += \ attribute-rel-svg.cpp attribute-rel-svg.h \ attribute-rel-css.cpp attribute-rel-css.h \ attribute-rel-util.cpp attribute-rel-util.h \ + attribute-sort-util.cpp attribute-sort-util.h \ axis-manip.cpp axis-manip.h \ bad-uri-exception.h \ box3d.cpp box3d.h \ diff --git a/src/attribute-sort-util.cpp b/src/attribute-sort-util.cpp new file mode 100644 index 000000000..ef08a142f --- /dev/null +++ b/src/attribute-sort-util.cpp @@ -0,0 +1,206 @@ +/* + * attribute-sort-util.cpp + * + * Created on: Jun 10, 2016 + * Author: Tavmjong Bah + */ + +/** + * Utility functions for sorting attributes by name. + */ + +#include +#include +#include +#include +#include +#include // std::pair +#include // std::sort + +#include "attribute-sort-util.h" + +#include "xml/repr.h" +#include "xml/attribute-record.h" +#include "xml/sp-css-attr.h" + +#include "attributes.h" + +using Inkscape::XML::Node; +using Inkscape::XML::AttributeRecord; +using Inkscape::Util::List; + +/** + * Sort attributes by name. + */ +void sp_attribute_sort_tree(Node *repr) { + + g_return_if_fail (repr != NULL); + + sp_attribute_sort_recursive( repr ); +} + +/** + * Sort recursively over all elements. + */ +void sp_attribute_sort_recursive(Node *repr) { + + g_return_if_fail (repr != NULL); + + if( repr->type() == Inkscape::XML::ELEMENT_NODE ) { + Glib::ustring element = repr->name(); + + // Only sort elements in svg namespace + if( element.substr(0,4) == "svg:" ) { + sp_attribute_sort_element( repr ); + } + } + + for(Node *child=repr->firstChild() ; child ; child = child->next()) { + sp_attribute_sort_recursive( child ); + } +} + +/** + * Compare function + */ +bool cmp(std::pair< Glib::ustring, Glib::ustring > const &a, + std::pair< Glib::ustring, Glib::ustring > const &b) { + unsigned val_b = sp_attribute_lookup(b.first.c_str()); + if (val_b == 0) return true; // Unknown attributes at end. + return sp_attribute_lookup(a.first.c_str()) < val_b; +} + +/** + * Sort attributes on an element + */ +void sp_attribute_sort_element(Node *repr) { + + g_return_if_fail (repr != NULL); + g_return_if_fail (repr->type() == Inkscape::XML::ELEMENT_NODE); + + // Glib::ustring element = repr->name(); + // Glib::ustring id = (repr->attribute( "id" )==NULL ? "" : repr->attribute( "id" )); + + sp_attribute_sort_style(repr); + + // Sort attributes: + + // It doesn't seem possible to sort a List directly so we dump the list into + // a std::list and sort that. Not very efficient. Sad. + List attributes = repr->attributeList(); + + std::vector > my_list; + for ( List iter = attributes ; iter ; ++iter ) { + + Glib::ustring attribute = g_quark_to_string(iter->key); + Glib::ustring value = (const char*)iter->value; + + // C++11 my_list.emlace_back(attribute, value); + my_list.push_back(std::make_pair(attribute,value)); + } + std::sort(my_list.begin(), my_list.end(), cmp); + // Delete all attributes. + //for (auto it: my_list) { + for (std::vector >::iterator it = my_list.begin(); + it != my_list.end(); ++it) { + repr->setAttribute( it->first.c_str(), NULL, false ); + } + // Insert all attributes in proper order + for (std::vector >::iterator it = my_list.begin(); + it != my_list.end(); ++it) { + repr->setAttribute( it->first.c_str(), it->second.c_str(), false ); + } +} + + +/** + * Sort CSS style on an element. + */ +void sp_attribute_sort_style(Node *repr) { + + g_return_if_fail (repr != NULL); + g_return_if_fail (repr->type() == Inkscape::XML::ELEMENT_NODE); + + // Find element's style + SPCSSAttr *css = sp_repr_css_attr( repr, "style" ); + sp_attribute_sort_style(repr, css); + + // Convert css node's properties data to string and set repr node's attribute "style" to that string. + // sp_repr_css_set( repr, css, "style"); // Don't use as it will cause loop. + Glib::ustring value; + sp_repr_css_write_string(css, value); + if( value.empty() ) { + repr->setAttribute("style", NULL ); + } else { + repr->setAttribute("style", value.c_str()); + } + + sp_repr_css_attr_unref( css ); +} + + +/** + * Sort CSS style on an element. + */ +Glib::ustring sp_attribute_sort_style(Node *repr, gchar const *string) { + + g_return_val_if_fail (repr != NULL, NULL); + g_return_val_if_fail (repr->type() == Inkscape::XML::ELEMENT_NODE, NULL); + + SPCSSAttr *css = sp_repr_css_attr_new(); + sp_repr_css_attr_add_from_string( css, string ); + sp_attribute_sort_style(repr, css); + Glib::ustring string_cleaned; + sp_repr_css_write_string (css, string_cleaned); + + sp_repr_css_attr_unref( css ); + + return string_cleaned; +} + + +/** + * Sort CSS style on an element. + */ +void sp_attribute_sort_style(Node* repr, SPCSSAttr *css) { + + g_return_if_fail (repr != NULL); + g_return_if_fail (css != NULL); + + Glib::ustring element = repr->name(); + Glib::ustring id = (repr->attribute( "id" )==NULL ? "" : repr->attribute( "id" )); + + // Loop over all properties in "style" node. + std::vector > my_list; + for ( List iter = css->attributeList() ; iter ; ++iter ) { + + Glib::ustring property = g_quark_to_string(iter->key); + Glib::ustring value = (const char*)iter->value; + + // C++11 my_list.emlace_back(property, value); + my_list.push_back(std::make_pair(property,value)); + } + std::sort(my_list.begin(), my_list.end(), cmp); + // Delete all attributes. + //for (auto it: my_list) { + for (std::vector >::iterator it = my_list.begin(); + it != my_list.end(); ++it) { + sp_repr_css_set_property( css, it->first.c_str(), NULL ); + } + // Insert all attributes in proper order + for (std::vector >::iterator it = my_list.begin(); + it != my_list.end(); ++it) { + sp_repr_css_set_property( css, it->first.c_str(), it->second.c_str() ); + } +} + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : diff --git a/src/attribute-sort-util.h b/src/attribute-sort-util.h new file mode 100644 index 000000000..0b2f81ed9 --- /dev/null +++ b/src/attribute-sort-util.h @@ -0,0 +1,62 @@ +#ifndef __SP_ATTRIBUTE_SORT_UTIL_H__ +#define __SP_ATTRIBUTE_SORT_UTIL_H__ + +/* + * attribute-sort-util.h + * + * Created on: Jun 10, 2016 + * Author: Tavmjong Bah + */ + +#include +#include "xml/sp-css-attr.h" + +using Inkscape::XML::Node; + +/** + * Utility functions for sorting attributes. + */ + +/** + * Sort attributes by name. + */ +void sp_attribute_sort_tree(Node *repr); + +/** + * Recursively sort. + * repr: the root node in a document or any other node. + */ +void sp_attribute_sort_recursive(Node *repr); + +/** + * Sort one element (attributes). + */ +void sp_attribute_sort_element(Node *repr); + +/** + * Sort style properties for one element. + */ +void sp_attribute_sort_style(Node *repr); + +/** + * Sort style_property for a style string + */ +Glib::ustring sp_attribute_sort_style(Node *repr, gchar const *string); + +/** + * Sort style properties for one CSS. + */ +void sp_attribute_sort_style(Node* repr, SPCSSAttr *css); + +#endif /* __SP_ATTRIBUTE_SORT_UTIL_H__ */ + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/attributes.cpp b/src/attributes.cpp index 24c16d5fc..e281dad65 100644 --- a/src/attributes.cpp +++ b/src/attributes.cpp @@ -420,11 +420,49 @@ static SPStyleProp const props[] = { {SP_ATTR_TEXT_EXCLUDE,"inkscape:excludeShape"}, {SP_ATTR_LAYOUT_OPTIONS,"inkscape:layoutOptions"}, - /* CSS2 */ - {SP_PROP_INKSCAPE_FONT_SPEC, "-inkscape-font-specification"}, + /* CSS & SVG Properites */ + + /* Paint */ + {SP_PROP_COLOR, "color"}, + {SP_PROP_OPACITY, "opacity"}, + {SP_PROP_FILL, "fill"}, + {SP_PROP_FILL_OPACITY, "fill-opacity"}, + {SP_PROP_FILL_RULE, "fill-rule"}, + {SP_PROP_STROKE, "stroke"}, + {SP_PROP_STROKE_OPACITY, "stroke-opacity"}, + {SP_PROP_STROKE_WIDTH, "stroke-width"}, + {SP_PROP_STROKE_LINECAP, "stroke-linecap"}, + {SP_PROP_STROKE_LINEJOIN, "stroke-linejoin"}, + {SP_PROP_STROKE_MITERLIMIT, "stroke-miterlimit"}, + {SP_PROP_STROKE_DASHARRAY, "stroke-dasharray"}, + {SP_PROP_STROKE_DASHOFFSET, "stroke-dashoffset"}, + {SP_PROP_MARKER, "marker"}, + {SP_PROP_MARKER_END, "marker-end"}, + {SP_PROP_MARKER_MID, "marker-mid"}, + {SP_PROP_MARKER_START, "marker-start"}, + {SP_PROP_PAINT_ORDER, "paint-order" }, + {SP_PROP_SOLID_COLOR, "solid-color"}, + {SP_PROP_SOLID_OPACITY, "solid-opacity"}, + + /* CSS Blending/Compositing */ + {SP_PROP_MIX_BLEND_MODE, "mix-blend-mode"}, + {SP_PROP_ISOLATION, "isolation"}, + + /* Misc. Display */ + {SP_PROP_DISPLAY, "display"}, + {SP_PROP_OVERFLOW, "overflow"}, + {SP_PROP_VISIBILITY, "visibility"}, + + /* Clip/Mask */ + {SP_PROP_CLIP, "clip"}, + {SP_PROP_CLIP_PATH, "clip-path"}, + {SP_PROP_CLIP_RULE, "clip-rule"}, + {SP_PROP_MASK, "mask"}, + /* Font */ {SP_PROP_FONT, "font"}, {SP_PROP_FONT_FAMILY, "font-family"}, + {SP_PROP_INKSCAPE_FONT_SPEC, "-inkscape-font-specification"}, {SP_PROP_FONT_SIZE, "font-size"}, {SP_PROP_FONT_SIZE_ADJUST, "font-size-adjust"}, {SP_PROP_FONT_STRETCH, "font-stretch"}, @@ -449,7 +487,7 @@ static SPStyleProp const props[] = { {SP_PROP_WORD_SPACING, "word-spacing"}, {SP_PROP_TEXT_TRANSFORM, "text-transform"}, - /* Text (css3) */ + /* Text (CSS3) */ {SP_PROP_DIRECTION, "direction"}, {SP_PROP_WRITING_MODE, "writing-mode"}, {SP_PROP_TEXT_ORIENTATION, "text-orientation"}, @@ -470,70 +508,43 @@ static SPStyleProp const props[] = { {SP_PROP_SHAPE_MARGIN, "shape-margin"}, /* Text Decoration */ - {SP_PROP_TEXT_DECORATION, "text-decoration"}, + {SP_PROP_TEXT_DECORATION, "text-decoration"}, // CSS 2/CSS3-Shorthand {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"}, - {SP_PROP_CURSOR, "cursor"}, - {SP_PROP_DISPLAY, "display"}, - {SP_PROP_OVERFLOW, "overflow"}, - {SP_PROP_VISIBILITY, "visibility"}, - {SP_PROP_MIX_BLEND_MODE, "mix-blend-mode"}, // CSS Blending and Compositing - {SP_PROP_ISOLATION, "isolation"}, - /* SVG */ - /* Clip/Mask */ - {SP_PROP_CLIP_PATH, "clip-path"}, - {SP_PROP_CLIP_RULE, "clip-rule"}, - {SP_PROP_MASK, "mask"}, - {SP_PROP_OPACITY, "opacity"}, /* Filter */ {SP_PROP_ENABLE_BACKGROUND, "enable-background"}, {SP_PROP_FILTER, "filter"}, {SP_PROP_FLOOD_COLOR, "flood-color"}, {SP_PROP_FLOOD_OPACITY, "flood-opacity"}, {SP_PROP_LIGHTING_COLOR, "lighting-color"}, + /* Gradient */ {SP_PROP_STOP_COLOR, "stop-color"}, {SP_PROP_STOP_OPACITY, "stop-opacity"}, {SP_PROP_STOP_PATH, "path"}, - /* Interactivity */ - {SP_PROP_POINTER_EVENTS, "pointer-events"}, - /* Paint */ + + /* Rendering */ {SP_PROP_COLOR_INTERPOLATION, "color-interpolation"}, {SP_PROP_COLOR_INTERPOLATION_FILTERS, "color-interpolation-filters"}, {SP_PROP_COLOR_PROFILE, "color-profile"}, {SP_PROP_COLOR_RENDERING, "color-rendering"}, - {SP_PROP_FILL, "fill"}, - {SP_PROP_FILL_OPACITY, "fill-opacity"}, - {SP_PROP_FILL_RULE, "fill-rule"}, {SP_PROP_IMAGE_RENDERING, "image-rendering"}, - {SP_PROP_MARKER, "marker"}, - {SP_PROP_MARKER_END, "marker-end"}, - {SP_PROP_MARKER_MID, "marker-mid"}, - {SP_PROP_MARKER_START, "marker-start"}, - {SP_PROP_PAINT_ORDER, "paint-order" }, {SP_PROP_SHAPE_RENDERING, "shape-rendering"}, - {SP_PROP_SOLID_COLOR, "solid-color"}, - {SP_PROP_SOLID_OPACITY, "solid-opacity"}, - {SP_PROP_STROKE, "stroke"}, - {SP_PROP_STROKE_DASHARRAY, "stroke-dasharray"}, - {SP_PROP_STROKE_DASHOFFSET, "stroke-dashoffset"}, - {SP_PROP_STROKE_LINECAP, "stroke-linecap"}, - {SP_PROP_STROKE_LINEJOIN, "stroke-linejoin"}, - {SP_PROP_STROKE_MITERLIMIT, "stroke-miterlimit"}, - {SP_PROP_STROKE_OPACITY, "stroke-opacity"}, - {SP_PROP_STROKE_WIDTH, "stroke-width"}, {SP_PROP_TEXT_RENDERING, "text-rendering"}, + + /* Interactivity */ + {SP_PROP_POINTER_EVENTS, "pointer-events"}, + {SP_PROP_CURSOR, "cursor"}, + /* Conditional */ {SP_PROP_SYSTEM_LANGUAGE, "systemLanguage"}, {SP_PROP_REQUIRED_FEATURES, "requiredFeatures"}, {SP_PROP_REQUIRED_EXTENSIONS, "requiredExtensions"}, + /* LivePathEffect */ {SP_PROP_PATH_EFFECT, "effect"}, }; diff --git a/src/attributes.h b/src/attributes.h index e82db5f2a..ff426e8cf 100644 --- a/src/attributes.h +++ b/src/attributes.h @@ -24,6 +24,13 @@ unsigned char const *sp_attribute_name(unsigned int id); */ #define SP_ATTRIBUTE_IS_CSS(k) (((k) >= SP_PROP_INKSCAPE_FONT_SPEC) && ((k) <= SP_PROP_TEXT_RENDERING)) +/* + * Do not change order of attributes and properties. Attribute and + * order in an SVG file is (optionally) determined by the order here. + * This makes comparing different versions of a drawing easier using + * line-by-line comparison. Also, inorder for proper parsing, some + * properites must be before others (e.g. 'font' before 'font-family'). + */ enum SPAttributeEnum { SP_ATTR_INVALID, ///< Must have value 0. /* SPObject */ @@ -420,14 +427,49 @@ enum SPAttributeEnum { SP_ATTR_TEXT_EXCLUDE, SP_ATTR_LAYOUT_OPTIONS, - /* CSS & SVG Properties */ + /* CSS & SVG Properties KEEP ORDER */ - /* Custom full font name because Font stuff below is inadequate REMOVE ME */ - SP_PROP_INKSCAPE_FONT_SPEC, + /* Paint */ + SP_PROP_COLOR, + SP_PROP_OPACITY, + SP_PROP_FILL, + SP_PROP_FILL_OPACITY, + SP_PROP_FILL_RULE, + SP_PROP_STROKE, + SP_PROP_STROKE_OPACITY, + SP_PROP_STROKE_WIDTH, + SP_PROP_STROKE_LINECAP, + SP_PROP_STROKE_LINEJOIN, + SP_PROP_STROKE_MITERLIMIT, + SP_PROP_STROKE_DASHARRAY, + SP_PROP_STROKE_DASHOFFSET, + SP_PROP_MARKER, + SP_PROP_MARKER_END, + SP_PROP_MARKER_MID, + SP_PROP_MARKER_START, + SP_PROP_PAINT_ORDER, /* SVG2 */ + SP_PROP_SOLID_COLOR, + SP_PROP_SOLID_OPACITY, + + /* CSS Blending/Compositing */ + SP_PROP_MIX_BLEND_MODE, + SP_PROP_ISOLATION, + + /* Misc. Display */ + SP_PROP_DISPLAY, + SP_PROP_OVERFLOW, + SP_PROP_VISIBILITY, - /* Font */ + /* Clip/Mask */ + SP_PROP_CLIP, + SP_PROP_CLIP_PATH, + SP_PROP_CLIP_RULE, + SP_PROP_MASK, + + /* Font: Order is important! */ SP_PROP_FONT, SP_PROP_FONT_FAMILY, + SP_PROP_INKSCAPE_FONT_SPEC, // Remove me SP_PROP_FONT_SIZE, SP_PROP_FONT_SIZE_ADJUST, SP_PROP_FONT_STRETCH, @@ -447,12 +489,12 @@ enum SPAttributeEnum { /* Text Layout */ SP_PROP_TEXT_INDENT, SP_PROP_TEXT_ALIGN, - SP_PROP_LINE_HEIGHT, SP_PROP_LETTER_SPACING, SP_PROP_WORD_SPACING, SP_PROP_TEXT_TRANSFORM, + /* Text (CSS3) */ SP_PROP_DIRECTION, SP_PROP_WRITING_MODE, SP_PROP_TEXT_ORIENTATION, @@ -472,32 +514,14 @@ enum SPAttributeEnum { SP_PROP_SHAPE_PADDING, SP_PROP_SHAPE_MARGIN, - /* Text Decoration CSS 2/CSS 3 Shorthand */ - SP_PROP_TEXT_DECORATION, - /* Text Decoration CSS 3/SVG 2 */ + /* Text Decoration */ + SP_PROP_TEXT_DECORATION, // CSS 2/CSS3-Shorthand 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, - SP_PROP_COLOR, - SP_PROP_CURSOR, - SP_PROP_DISPLAY, - SP_PROP_OVERFLOW, - SP_PROP_VISIBILITY, - SP_PROP_MIX_BLEND_MODE, - SP_PROP_ISOLATION, - - /* SVG */ - /* Clip/Mask */ - SP_PROP_CLIP_PATH, - SP_PROP_CLIP_RULE, - SP_PROP_MASK, - SP_PROP_OPACITY, - /* Filter */ SP_PROP_ENABLE_BACKGROUND, SP_PROP_FILTER, @@ -510,36 +534,19 @@ enum SPAttributeEnum { SP_PROP_STOP_OPACITY, SP_PROP_STOP_PATH, - /* Interactivity */ - SP_PROP_POINTER_EVENTS, - - /* Paint */ + /* Rendering */ SP_PROP_COLOR_INTERPOLATION, SP_PROP_COLOR_INTERPOLATION_FILTERS, SP_PROP_COLOR_PROFILE, SP_PROP_COLOR_RENDERING, - SP_PROP_FILL, - SP_PROP_FILL_OPACITY, - SP_PROP_FILL_RULE, SP_PROP_IMAGE_RENDERING, - SP_PROP_MARKER, - SP_PROP_MARKER_END, - SP_PROP_MARKER_MID, - SP_PROP_MARKER_START, - SP_PROP_PAINT_ORDER, /* SVG2 */ SP_PROP_SHAPE_RENDERING, - SP_PROP_SOLID_COLOR, - SP_PROP_SOLID_OPACITY, - SP_PROP_STROKE, - SP_PROP_STROKE_DASHARRAY, - SP_PROP_STROKE_DASHOFFSET, - SP_PROP_STROKE_LINECAP, - SP_PROP_STROKE_LINEJOIN, - SP_PROP_STROKE_MITERLIMIT, - SP_PROP_STROKE_OPACITY, - SP_PROP_STROKE_WIDTH, SP_PROP_TEXT_RENDERING, + /* Interactivity */ + SP_PROP_POINTER_EVENTS, + SP_PROP_CURSOR, + /* Conditional */ SP_PROP_SYSTEM_LANGUAGE, SP_PROP_REQUIRED_FEATURES, diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h index 5ccc4d729..38196a58e 100644 --- a/src/preferences-skeleton.h +++ b/src/preferences-skeleton.h @@ -338,7 +338,8 @@ static char const preferences_skeleton[] = " style_defaults_remove=\"0\" " " check_on_reading=\"0\" " " check_on_editing=\"0\" " -" check_on_writing=\"0\"/>\n" +" check_on_writing=\"0\" " +" sort_attributes=\"0\"/>\n" " \n" " \n" diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp index 4a6f59b43..6977bc1e2 100644 --- a/src/xml/repr-io.cpp +++ b/src/xml/repr-io.cpp @@ -34,6 +34,7 @@ #include "extension/extension.h" #include "attribute-rel-util.h" +#include "attribute-sort-util.h" #include "preferences.h" @@ -882,6 +883,10 @@ static void sp_repr_write_stream_root_element(Node *repr, Writer &out, bool clean = prefs->getBool("/options/svgoutput/check_on_writing"); if (clean) sp_attribute_clean_tree( repr ); + // Sort attributes in a canonical order (helps with "diffing" SVG files). + bool sort = prefs->getBool("/options/svgoutput/sort_attributes"); + if (sort) sp_attribute_sort_tree( repr ); + Glib::QueryQuark xml_prefix=g_quark_from_static_string("xml"); NSMap ns_map; -- cgit v1.2.3 From edc19028160caa0d92b943232483ba76fa8ea75b Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 12 Jun 2016 18:27:42 +0200 Subject: Fix bug 'Persistent measure repositions on middle click' Fixed bugs: - https://launchpad.net/bugs/1591662 (bzr r14982) --- src/ui/tools/measure-tool.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/ui/tools/measure-tool.cpp b/src/ui/tools/measure-tool.cpp index 5900a2359..0977729ae 100644 --- a/src/ui/tools/measure-tool.cpp +++ b/src/ui/tools/measure-tool.cpp @@ -565,7 +565,6 @@ bool MeasureTool::root_handler(GdkEvent* event) explicit_base = boost::none; explicit_base_tmp = boost::none; last_end = boost::none; - start_p = desktop->w2d(button_w); if (event->button.button == 1 && !this->space_panning) { // save drag origin -- cgit v1.2.3 From 51cd1dfb720642e51b811558ddead6cd47ceee0f Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sun, 12 Jun 2016 20:08:22 +0200 Subject: Fix faulty comparison function. (bzr r14983) --- src/attribute-sort-util.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/attribute-sort-util.cpp b/src/attribute-sort-util.cpp index ef08a142f..d0f45c418 100644 --- a/src/attribute-sort-util.cpp +++ b/src/attribute-sort-util.cpp @@ -65,9 +65,11 @@ void sp_attribute_sort_recursive(Node *repr) { */ bool cmp(std::pair< Glib::ustring, Glib::ustring > const &a, std::pair< Glib::ustring, Glib::ustring > const &b) { + unsigned val_a = sp_attribute_lookup(a.first.c_str()); unsigned val_b = sp_attribute_lookup(b.first.c_str()); - if (val_b == 0) return true; // Unknown attributes at end. - return sp_attribute_lookup(a.first.c_str()) < val_b; + if (val_a == 0) return false; // Unknown attributes at end. + if (val_b == 0) return true; // Unknown attributes at end. + return val_a < val_b; } /** -- cgit v1.2.3 From 35fc5dc7a7667ad3e79b409fb588c1cc56e2ab57 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 13 Jun 2016 00:10:49 +0200 Subject: Fix a helper path data (bzr r14984) --- src/live_effects/lpe-transform_2pts.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/live_effects/lpe-transform_2pts.cpp b/src/live_effects/lpe-transform_2pts.cpp index 1cd59b7fa..3c4ce0708 100644 --- a/src/live_effects/lpe-transform_2pts.cpp +++ b/src/live_effects/lpe-transform_2pts.cpp @@ -434,7 +434,7 @@ LPETransform2Pts::addCanvasIndicators(SPLPEItem const */*lpeitem*/, std::vector< } if(!lock_angle && lock_lenght) { char const * svgd; - svgd = "m 7.07,7.07 c -3.9,3.91 -10.24,3.91 -14.14,0 -3.91,-3.9 -3.91,-10.24 0,-14.14 3.9,-3.91 10.24,-3.91 14.14,0 l -2.83,-4.24 -0.7,2.12"; + svgd = "M 0,9.94 C -2.56,9.91 -5.17,8.98 -7.07,7.07 c -3.91,-3.9 -3.91,-10.24 0,-14.14 1.97,-1.97 4.51,-3.02 7.07,-3.04 2.56,0.02 5.1,1.07 7.07,3.04 3.91,3.9 3.91,10.24 0,14.14 C 5.17,8.98 2.56,9.91 0,9.94 Z"; PathVector pathv_turn = sp_svg_read_pathv(svgd); pathv_turn *= Geom::Rotate(previous_angle); pathv_turn *= Affine(r,0,0,r,0,0) * Translate(Geom::Point(end)); -- cgit v1.2.3 From 3e173aedbe72ba21d33eaec804bf4c9f8e9fa158 Mon Sep 17 00:00:00 2001 From: brock-alexander Date: Tue, 14 Jun 2016 12:26:58 +0200 Subject: Merging lp:~inkscape+alexander/inkscape/comments into lp:inkscape. (bzr r14986) --- src/document.cpp | 22 ++++++++++++++++++++++ src/document.h | 2 +- src/sp-object.cpp | 15 ++++++++++++++- 3 files changed, 37 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/document.cpp b/src/document.cpp index d8c3f1269..902dabbc3 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -1602,11 +1602,22 @@ static unsigned int count_objects_recursive(SPObject *obj, unsigned int count) return count; } +/** + * Count the number of objects in a given document recursively using the count_objects_recursive helper function + * + * @param[in] document Pointer to the document for counting objects + * @return Numer of objects in the document + */ static unsigned int objects_in_document(SPDocument *document) { return count_objects_recursive(document->getRoot(), 0); } +/** + * Remove unused definitions etc. recursively from an object and its siblings + * + * @param[inout] obj Object which shall be "cleaned" + */ static void vacuum_document_recursive(SPObject *obj) { if (SP_IS_DEFS(obj)) { @@ -1621,6 +1632,11 @@ static void vacuum_document_recursive(SPObject *obj) } } +/** + * Remove unused definitions etc. recursively from an entire document. + * + * @return Number of removed objects + */ unsigned int SPDocument::vacuumDocument() { unsigned int start = objects_in_document(this); @@ -1639,6 +1655,7 @@ unsigned int SPDocument::vacuumDocument() newend = objects_in_document(this); } while (iterations < 100 && newend < end); + // We stop if vacuum_document_recursive doesn't remove any more objects or after 100 iterations, whichever occurs first. return start - newend; } @@ -1647,6 +1664,11 @@ bool SPDocument::isSeeking() const { return priv->seeking; } +/** + * Indicate to the user if the document has been modified since the last save by displaying a "*" in front of the name of the file in the window title. + * + * @param[in] modified True if the document has been modified. + */ void SPDocument::setModifiedSinceSave(bool modified) { this->modified_since_save = modified; if (SP_ACTIVE_DESKTOP) { diff --git a/src/document.h b/src/document.h index e95042155..813d4ae49 100644 --- a/src/document.h +++ b/src/document.h @@ -198,7 +198,7 @@ public: bool isSeeking() const; bool isModifiedSinceSave() const { return modified_since_save; } - void setModifiedSinceSave(bool modified = true); + void setModifiedSinceSave(bool const modified = true); private: SPDocument(SPDocument const &); // no copy diff --git a/src/sp-object.cpp b/src/sp-object.cpp index db66eb3e6..d1659eedc 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -71,13 +71,17 @@ Inkscape::XML::NodeEventVector object_event_vector = { SPObject::repr_order_changed }; -// A friend class used to set internal members on SPObject so as to not expose settors in SPObject's public API +/** + * A friend class used to set internal members on SPObject so as to not expose settors in SPObject's public API + */ class SPObjectImpl { public: /** * Null's the id member of an SPObject without attempting to free prior contents. + * + * @param[inout] obj Pointer to the object which's id shall be nulled. */ static void setIdNull( SPObject* obj ) { if (obj) { @@ -87,6 +91,9 @@ public: /** * Sets the id member of an object, freeing any prior content. + * + * @param[inout] obj Pointer to the object which's id shall be set. + * @param[in] id New id */ static void setId( SPObject* obj, gchar const* id ) { if (obj && (id != obj->id) ) { @@ -104,6 +111,9 @@ public: static gchar *sp_object_get_unique_id(SPObject *object, gchar const *defid); +/** + * Constructor, sets all attributes to default values. + */ SPObject::SPObject() : cloned(0), uflags(0), mflags(0), hrefcount(0), _total_hrefcount(0), document(NULL), parent(NULL), children(NULL), _last_child(NULL), @@ -126,6 +136,9 @@ SPObject::SPObject() this->context_style = NULL; } +/** + * Destructor, frees the used memory and unreferences a potential successor of the object. + */ SPObject::~SPObject() { g_free(this->_label); g_free(this->_default_label); -- cgit v1.2.3 From 41c854edad820e281097f6ba8f17ea89521155ea Mon Sep 17 00:00:00 2001 From: Mark Harmer Date: Tue, 14 Jun 2016 14:33:17 +0200 Subject: [Bug #1300865] lcms2: crash in Fill and Stroke if linked color profile is missing on local system. Fixed bugs: - https://launchpad.net/bugs/1300865 (bzr r14987) --- src/color-profile.cpp | 6 +++++- src/ui/widget/color-icc-selector.cpp | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/color-profile.cpp b/src/color-profile.cpp index 9e545df03..aea9ccab0 100644 --- a/src/color-profile.cpp +++ b/src/color-profile.cpp @@ -588,7 +588,11 @@ bool ColorProfile::GamutCheck(SPColor color) static_cast(SP_RGBA32_G_U(val)), static_cast(SP_RGBA32_B_U(val)), 255}; - cmsDoTransform(ColorProfile::getTransfGamutCheck(), &check_color, &outofgamut, 1); + + cmsHTRANSFORM gamutCheck = ColorProfile::getTransfGamutCheck(); + if (gamutCheck) { + cmsDoTransform(gamutCheck, &check_color, &outofgamut, 1); + } #if HAVE_LIBLCMS1 cmsSetAlarmCodes(alarm_r, alarm_g, alarm_b); diff --git a/src/ui/widget/color-icc-selector.cpp b/src/ui/widget/color-icc-selector.cpp index b422892fe..e4f58fe8a 100644 --- a/src/ui/widget/color-icc-selector.cpp +++ b/src/ui/widget/color-icc-selector.cpp @@ -633,9 +633,10 @@ void ColorICCSelectorImpl::_switchToProfile(gchar const *name) #endif // DEBUG_LCMS tmp.set(SP_RGBA32_U_COMPOSE(pre[0], pre[1], pre[2], 0xff)); } + + dirty = true; } } - dirty = true; } } else { -- cgit v1.2.3 From 425108aeb0731b11a5751b04f8e029b7a48ad0ab Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Thu, 16 Jun 2016 14:01:16 +0200 Subject: Fix z-cycling (alt+mousewheel) behavior Fixed bugs: - https://launchpad.net/bugs/1589420 (bzr r14988) --- src/ui/tools/select-tool.cpp | 199 ++++++++++++++++++------------------------- src/ui/tools/select-tool.h | 3 +- 2 files changed, 84 insertions(+), 118 deletions(-) (limited to 'src') diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp index 905e38f2b..5b48d65be 100644 --- a/src/ui/tools/select-tool.cpp +++ b/src/ui/tools/select-tool.cpp @@ -111,7 +111,6 @@ SelectTool::SelectTool() //static gint tolerance = 0; //static bool within_tolerance = false; static bool is_cycling = false; -static bool moved_while_cycling = false; SelectTool::~SelectTool() { @@ -386,54 +385,68 @@ bool SelectTool::item_handler(SPItem* item, GdkEvent* event) { } void SelectTool::sp_select_context_cycle_through_items(Inkscape::Selection *selection, GdkEventScroll *scroll_event, bool shift_pressed) { - if (this->cycling_cur_item == this->cycling_items.end()) { + if ( this->cycling_items.empty() ) return; - } Inkscape::DrawingItem *arenaitem; - SPItem *item = *cycling_cur_item; - g_assert(item != NULL); - // Deactivate current item - if (std::find(cycling_items_selected_before.begin(), cycling_items_selected_before.end(), item) == cycling_items_selected_before.end() && selection->includes(item)) { - selection->remove(item); + if(cycling_cur_item) { + arenaitem = cycling_cur_item->get_arenaitem(desktop->dkey); + arenaitem->setOpacity(0.3); } - arenaitem = item->get_arenaitem(desktop->dkey); - arenaitem->setOpacity(0.3); - // Find next item and activate it - std::vector::iterator next = this->cycling_cur_item; + + + std::vector::iterator next = cycling_items.end(); + if (scroll_event->direction == GDK_SCROLL_UP) { - ++next; - if (next == this->cycling_items.end() && this->cycling_wrap) { - next = this->cycling_items.begin(); + if (! cycling_cur_item) { + next = cycling_items.begin(); + } else { + next = std::find( cycling_items.begin(), cycling_items.end(), cycling_cur_item ); + g_assert (next != cycling_items.end()); + next++; + if (next == cycling_items.end()) + if ( cycling_wrap ) + next = cycling_items.begin(); + else + next--; } - } else { - if(next == this->cycling_items.begin()) { - next = this->cycling_items.end(); + } else { + if (! cycling_cur_item) { + next = cycling_items.end(); + next--; + } else { + next = std::find( cycling_items.begin(), cycling_items.end(), cycling_cur_item ); + g_assert (next != cycling_items.end()); + if (next == cycling_items.begin()){ + if ( cycling_wrap ) { + next = cycling_items.end(); + next--; + } + } else { + next--; + } } - --next; } - if (next!=this->cycling_items.end()) { - this->cycling_cur_item = next; - item = *next; - g_assert(item != NULL); - } + this->cycling_cur_item = *next; + g_assert(next != cycling_items.end()); + g_assert(cycling_cur_item != NULL); - arenaitem = item->get_arenaitem(desktop->dkey); + arenaitem = cycling_cur_item->get_arenaitem(desktop->dkey); arenaitem->setOpacity(1.0); if (shift_pressed) { - selection->add(item); + selection->add(cycling_cur_item); } else { - selection->set(item); + selection->set(cycling_cur_item); } } void SelectTool::sp_select_context_reset_opacities() { - for (std::vector::const_iterator l = this->cycling_items.begin(); l != this->cycling_items.end(); ++l ) { + for (std::vector::const_iterator l = this->cycling_items_cmp.begin(); l != this->cycling_items_cmp.end(); ++l ) { SPItem *item = *l; if (item) { Inkscape::DrawingItem *arenaitem = item->get_arenaitem(desktop->dkey); @@ -443,10 +456,8 @@ void SelectTool::sp_select_context_reset_opacities() { } } - this->cycling_items.clear(); - this->cycling_items_selected_before.clear(); - this->cycling_cur_item = this->cycling_items.end(); this->cycling_items_cmp.clear(); + this->cycling_cur_item = NULL; } bool SelectTool::root_handler(GdkEvent* event) { @@ -533,11 +544,7 @@ bool SelectTool::root_handler(GdkEvent* event) { case GDK_MOTION_NOTIFY: { - if (is_cycling) { - moved_while_cycling = true; - } - - tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100); + tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100); if ((event->motion.state & GDK_BUTTON1_MASK) && !this->space_panning) { Geom::Point const motion_pt(event->motion.x, event->motion.y); @@ -796,98 +803,58 @@ bool SelectTool::root_handler(GdkEvent* event) { break; case GDK_SCROLL: { - GdkEventScroll *scroll_event = (GdkEventScroll*) event; - - if (scroll_event->state & GDK_MOD1_MASK) { // alt modified pressed - if (moved_while_cycling) { - moved_while_cycling = false; - this->sp_select_context_reset_opacities(); - } - is_cycling = true; - - bool shift_pressed = scroll_event->state & GDK_SHIFT_MASK; - - /* Rebuild list of items underneath the mouse pointer */ - Geom::Point p = desktop->d2w(desktop->point()); - SPItem *item = desktop->getItemAtPoint(p, true, NULL); - - // Save pointer to current cycle-item so that we can find it again later, in the freshly built list - SPItem *tmp_cur_item = this->cycling_cur_item!=this->cycling_items.end() ? (*(this->cycling_cur_item)) : NULL; - this->cycling_items.clear(); - this->cycling_cur_item = this->cycling_items.end(); - while(item != NULL) { - this->cycling_items.push_back(item); - item = desktop->getItemAtPoint(p, true, item); - } - - /* Compare current item list with item list during previous scroll ... */ - bool item_lists_differ = this->cycling_items != this->cycling_items_cmp; - - /* If list of items under mouse pointer hasn't changed ... */ - if (!item_lists_differ) { - // ... find current item in the freshly built list and continue cycling ... - // TODO: This wouldn't be necessary if cycling_cur_item pointed to an element of cycling_items_cmp instead - this->cycling_cur_item = std::find(this->cycling_items.begin(), this->cycling_items.end(), tmp_cur_item); - g_assert(this->cycling_cur_item != this->cycling_items.end() || this->cycling_items.empty()); - } else { - // ... otherwise reset opacities for outdated items ... - Inkscape::DrawingItem *arenaitem; - - for (std::vector::const_iterator l = this->cycling_items_cmp.begin(); l != this->cycling_items_cmp.end(); ++l) { - SPItem *item = *l; - if (item) { - arenaitem = item->get_arenaitem(desktop->dkey); - arenaitem->setOpacity(1.0); - //if (!shift_pressed && !g_list_find(this->cycling_items_selected_before, item) && selection->includes(item)) - if (std::find(this->cycling_items_selected_before.begin(),this->cycling_items_selected_before.end(), item)==this->cycling_items_selected_before.end() && selection->includes(item)) { - selection->remove(item); - } - } - } + GdkEventScroll *scroll_event = (GdkEventScroll*) event; - // ... clear the lists ... + if ( ! (scroll_event->state & GDK_MOD1_MASK)) // do nothing specific if alt was not pressed + break; - this->cycling_items_cmp.clear(); - this->cycling_items_selected_before.clear(); - this->cycling_cur_item = this->cycling_items.end(); + bool shift_pressed = scroll_event->state & GDK_SHIFT_MASK; + is_cycling = true; - // ... and rebuild them with the new items. - this->cycling_items_cmp = (this->cycling_items); + /* Rebuild list of items underneath the mouse pointer */ + Geom::Point p = desktop->d2w(desktop->point()); + SPItem *item = desktop->getItemAtPoint(p, true, NULL); + this->cycling_items.clear(); - for(std::vector::const_iterator l = this->cycling_items.begin(); l != this->cycling_items.end(); ++l) { - SPItem *item =*l; - if (item) { - arenaitem = item->get_arenaitem(desktop->dkey); - arenaitem->setOpacity(0.3); + SPItem *tmp = NULL; + while(item != NULL) { + this->cycling_items.push_back(item); + item = desktop->getItemAtPoint(p, true, item); + if (selection->includes(item)) tmp = item; + } - if (selection->includes(item)) { - // already selected items are stored separately, too - this->cycling_items_selected_before.push_back(item); - } - } else { - g_assert_not_reached(); - } + /* Compare current item list with item list during previous scroll ... */ + bool item_lists_differ = this->cycling_items != this->cycling_items_cmp; + + if(item_lists_differ) { + this->sp_select_context_reset_opacities(); + for (std::vector::const_iterator l = this->cycling_items_cmp.begin(); l != this->cycling_items_cmp.end(); ++l) + selection->remove(*l); // deselects the previous content of the cycling loop + this->cycling_items_cmp = (this->cycling_items); + + // set opacities in new stack + for(std::vector::const_iterator l = this->cycling_items.begin(); l != this->cycling_items.end(); ++l) { + SPItem *item =*l; + if (item) { + Inkscape::DrawingItem *arenaitem = item->get_arenaitem(desktop->dkey); + arenaitem->setOpacity(0.3); } - - // set the current item to the bottommost one so that the cycling step below re-starts at the top - this->cycling_cur_item = this->cycling_items.end(); - this->cycling_cur_item--; } + } + if(!cycling_cur_item) cycling_cur_item = tmp; - this->cycling_wrap = prefs->getBool("/options/selection/cycleWrap", true); + this->cycling_wrap = prefs->getBool("/options/selection/cycleWrap", true); - // Cycle through the items underneath the mouse pointer, one-by-one - this->sp_select_context_cycle_through_items(selection, scroll_event, shift_pressed); + // Cycle through the items underneath the mouse pointer, one-by-one + this->sp_select_context_cycle_through_items(selection, scroll_event, shift_pressed); - ret = TRUE; + ret = TRUE; - GtkWindow *w =GTK_WINDOW(gtk_widget_get_toplevel( GTK_WIDGET(desktop->canvas) )); - if (w) - { - gtk_window_present(w); - gtk_widget_grab_focus (GTK_WIDGET(desktop->canvas)); - } + GtkWindow *w =GTK_WINDOW(gtk_widget_get_toplevel( GTK_WIDGET(desktop->canvas) )); + if (w) { + gtk_window_present(w); + gtk_widget_grab_focus (GTK_WIDGET(desktop->canvas)); } break; } diff --git a/src/ui/tools/select-tool.h b/src/ui/tools/select-tool.h index af183b1ca..420374661 100644 --- a/src/ui/tools/select-tool.h +++ b/src/ui/tools/select-tool.h @@ -42,8 +42,7 @@ public: std::vector cycling_items; std::vector cycling_items_cmp; - std::vector cycling_items_selected_before; - std::vector::iterator cycling_cur_item; + SPItem *cycling_cur_item; bool cycling_wrap; SPItem *item; -- cgit v1.2.3 From f5eb74652e628b4424647e798da1d0c05d6f4b2f Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Thu, 16 Jun 2016 14:07:58 +0200 Subject: remove tabs (bzr r14989) --- src/ui/tools/select-tool.cpp | 58 ++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp index 5b48d65be..b5ec3d88e 100644 --- a/src/ui/tools/select-tool.cpp +++ b/src/ui/tools/select-tool.cpp @@ -65,7 +65,7 @@ static gint rb_escaped = 0; // if non-zero, rubberband was canceled by esc, so t static gint drag_escaped = 0; // if non-zero, drag was canceled by esc const std::string& SelectTool::getPrefsPath() { - return SelectTool::prefsPath; + return SelectTool::prefsPath; } const std::string SelectTool::prefsPath = "/tools/select"; @@ -296,7 +296,7 @@ bool SelectTool::item_handler(SPItem* item, GdkEvent* event) { } else { GdkWindow* window = gtk_widget_get_window (GTK_WIDGET (desktop->getCanvas())); - this->dragging = TRUE; + this->dragging = TRUE; this->moved = FALSE; gdk_window_set_cursor(window, CursorSelectDragging); @@ -346,11 +346,11 @@ bool SelectTool::item_handler(SPItem* item, GdkEvent* event) { break; } case GDK_LEAVE_NOTIFY: - if (!desktop->isWaitingCursor() && !this->dragging) { + if (!desktop->isWaitingCursor() && !this->dragging) { GdkWindow* window = gtk_widget_get_window (GTK_WIDGET (desktop->getCanvas())); gdk_window_set_cursor(window, this->cursor); - } + } break; case GDK_KEY_PRESS: @@ -378,7 +378,7 @@ bool SelectTool::item_handler(SPItem* item, GdkEvent* event) { } if (!ret) { - ret = ToolBase::item_handler(item, event); + ret = ToolBase::item_handler(item, event); } return ret; @@ -710,7 +710,7 @@ bool SelectTool::root_handler(GdkEvent* event) { if (r->is_started() && !within_tolerance) { // this was a rubberband drag - std::vector items; + std::vector items; if (r->getMode() == RUBBERBAND_MODE_RECT) { Geom::OptRect const b = r->getRectangle(); @@ -860,10 +860,10 @@ bool SelectTool::root_handler(GdkEvent* event) { } case GDK_KEY_PRESS: // keybindings for select context - { - { - guint keyval = get_group0_keyval(&event->key); - + { + { + guint keyval = get_group0_keyval(&event->key); + bool alt = ( MOD__ALT(event) || (keyval == GDK_KEY_Alt_L) || (keyval == GDK_KEY_Alt_R) @@ -891,7 +891,7 @@ bool SelectTool::root_handler(GdkEvent* event) { // if Alt and nonempty selection, show moving cursor ("move selected"): if (alt && !selection->isEmpty() && !desktop->isWaitingCursor()) { - GdkWindow* window = gtk_widget_get_window (GTK_WIDGET (desktop->getCanvas())); + GdkWindow* window = gtk_widget_get_window (GTK_WIDGET (desktop->getCanvas())); gdk_window_set_cursor(window, CursorSelectDragging); } @@ -912,15 +912,15 @@ bool SelectTool::root_handler(GdkEvent* event) { if (MOD__ALT(event)) { // alt if (MOD__SHIFT(event)) { - sp_selection_move_screen(desktop->getSelection(), mul*-10, 0); // shift + sp_selection_move_screen(desktop->getSelection(), mul*-10, 0); // shift } else { - sp_selection_move_screen(desktop->getSelection(), mul*-1, 0); // no shift + sp_selection_move_screen(desktop->getSelection(), mul*-1, 0); // no shift } } else { // no alt if (MOD__SHIFT(event)) { - sp_selection_move(desktop->getSelection(), mul*-10*nudge, 0); // shift + sp_selection_move(desktop->getSelection(), mul*-10*nudge, 0); // shift } else { - sp_selection_move(desktop->getSelection(), mul*-nudge, 0); // no shift + sp_selection_move(desktop->getSelection(), mul*-nudge, 0); // no shift } } @@ -935,15 +935,15 @@ bool SelectTool::root_handler(GdkEvent* event) { if (MOD__ALT(event)) { // alt if (MOD__SHIFT(event)) { - sp_selection_move_screen(desktop->getSelection(), 0, mul*10); // shift + sp_selection_move_screen(desktop->getSelection(), 0, mul*10); // shift } else { - sp_selection_move_screen(desktop->getSelection(), 0, mul*1); // no shift + sp_selection_move_screen(desktop->getSelection(), 0, mul*1); // no shift } } else { // no alt if (MOD__SHIFT(event)) { - sp_selection_move(desktop->getSelection(), 0, mul*10*nudge); // shift + sp_selection_move(desktop->getSelection(), 0, mul*10*nudge); // shift } else { - sp_selection_move(desktop->getSelection(), 0, mul*nudge); // no shift + sp_selection_move(desktop->getSelection(), 0, mul*nudge); // no shift } } @@ -958,15 +958,15 @@ bool SelectTool::root_handler(GdkEvent* event) { if (MOD__ALT(event)) { // alt if (MOD__SHIFT(event)) { - sp_selection_move_screen(desktop->getSelection(), mul*10, 0); // shift + sp_selection_move_screen(desktop->getSelection(), mul*10, 0); // shift } else { - sp_selection_move_screen(desktop->getSelection(), mul*1, 0); // no shift + sp_selection_move_screen(desktop->getSelection(), mul*1, 0); // no shift } } else { // no alt if (MOD__SHIFT(event)) { - sp_selection_move(desktop->getSelection(), mul*10*nudge, 0); // shift + sp_selection_move(desktop->getSelection(), mul*10*nudge, 0); // shift } else { - sp_selection_move(desktop->getSelection(), mul*nudge, 0); // no shift + sp_selection_move(desktop->getSelection(), mul*nudge, 0); // no shift } } @@ -981,15 +981,15 @@ bool SelectTool::root_handler(GdkEvent* event) { if (MOD__ALT(event)) { // alt if (MOD__SHIFT(event)) { - sp_selection_move_screen(desktop->getSelection(), 0, mul*-10); // shift + sp_selection_move_screen(desktop->getSelection(), 0, mul*-10); // shift } else { - sp_selection_move_screen(desktop->getSelection(), 0, mul*-1); // no shift + sp_selection_move_screen(desktop->getSelection(), 0, mul*-1); // no shift } } else { // no alt if (MOD__SHIFT(event)) { - sp_selection_move(desktop->getSelection(), 0, mul*-10*nudge); // shift + sp_selection_move(desktop->getSelection(), 0, mul*-10*nudge); // shift } else { - sp_selection_move(desktop->getSelection(), 0, mul*-nudge); // no shift + sp_selection_move(desktop->getSelection(), 0, mul*-nudge); // no shift } } @@ -1133,7 +1133,7 @@ bool SelectTool::root_handler(GdkEvent* event) { break; } break; - } + } case GDK_KEY_RELEASE: { guint keyval = get_group0_keyval(&event->key); if (key_is_a_modifier (keyval)) { @@ -1174,7 +1174,7 @@ bool SelectTool::root_handler(GdkEvent* event) { } if (!ret) { - ret = ToolBase::root_handler(event); + ret = ToolBase::root_handler(event); } return ret; -- cgit v1.2.3 From 5d388f13644b59e355e0980c74695247b2191562 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 16 Jun 2016 22:29:40 +0200 Subject: Fixes some bugs related to powerstroke 'Powerstroke infinite loop' Fixed bugs: - https://launchpad.net/bugs/1535444 - https://launchpad.net/bugs/1236320 - https://launchpad.net/bugs/1586973 (bzr r14991) --- src/2geom/sbasis-geometric.cpp | 9 ++++---- src/live_effects/lpe-powerstroke.cpp | 25 ++++++++-------------- src/ui/tools/freehand-base.cpp | 40 +++++++++--------------------------- 3 files changed, 23 insertions(+), 51 deletions(-) (limited to 'src') diff --git a/src/2geom/sbasis-geometric.cpp b/src/2geom/sbasis-geometric.cpp index 8aaa15144..19eccc451 100644 --- a/src/2geom/sbasis-geometric.cpp +++ b/src/2geom/sbasis-geometric.cpp @@ -101,7 +101,7 @@ static SBasis divide_by_t1k(SBasis const &a, int k) { static D2 RescaleForNonVanishingEnds(D2 const &MM, double ZERO=1.e-4){ D2 M = MM; //TODO: divide by all the s at once!!! - while ((M[0].size()>0||M[1].size()>0) && + while ((M[0].size()>1||M[1].size()>1) && fabs(M[0].at0()) RescaleForNonVanishingEnds(D2 const &MM, double ZERO=1 M[0] = divide_by_sk(M[0],1); M[1] = divide_by_sk(M[1],1); } - while ((M[0].size()>0||M[1].size()>0) && + while ((M[0].size()>1||M[1].size()>1) && fabs(M[0].at0())0||M[1].size()>0) && + while ((M[0].size()>1||M[1].size()>1) && fabs(M[0].at1()) const &V_in, double tol, unsigned order){ // -This approach is numerically bad. Find a stable way to rescale V_in to have non vanishing ends. // -This done, unitVector will have jumps at zeros: fill the gaps with arcs of circles. D2 V = RescaleForNonVanishingEnds(V_in); - if (V[0].isZero(0) && V[1].isZero(0)) return Piecewise >(D2(Linear(1),SBasis())); + SBasis x = V[0], y = V[1]; SBasis r_eqn1, r_eqn2; @@ -242,7 +242,6 @@ Geom::unitVector(D2 const &V_in, double tol, unsigned order){ r_eqn1 = -(a*x+b*y); r_eqn2 = Linear(1.)-(a*a+b*b); - for (unsigned k=1; k<=order; k++){ double r0 = (k #include <2geom/circle.h> #include <2geom/math-utils.h> +#include "helper/geom.h" #include #include "spiro.h" @@ -205,14 +206,13 @@ LPEPowerStroke::~LPEPowerStroke() } - void LPEPowerStroke::doOnApply(SPLPEItem const* lpeitem) { - if (SP_IS_SHAPE(lpeitem)) { + if (SP_IS_SHAPE(lpeitem) && offset_points.data().empty()) { SPLPEItem* item = const_cast(lpeitem); std::vector points; - Geom::PathVector const &pathv = SP_SHAPE(lpeitem)->_curve->get_pathvector(); + Geom::PathVector const &pathv = pathv_to_linear_and_cubic_beziers(SP_SHAPE(lpeitem)->_curve->get_pathvector()); double width = (lpeitem && lpeitem->style) ? lpeitem->style->stroke_width.computed / 2 : 1.; SPCSSAttr *css = sp_repr_css_attr_new (); @@ -565,12 +565,11 @@ LPEPowerStroke::doEffect_path (Geom::PathVector const & path_in) if (path_in.empty()) { return path_out; } - - // for now, only regard first subpath and ignore the rest - Geom::Piecewise > pwd2_in = path_in[0].toPwSb(); - + Geom::PathVector pathv = pathv_to_linear_and_cubic_beziers(path_in); + Geom::Piecewise > pwd2_in = pathv[0].toPwSb(); Piecewise > der = derivative(pwd2_in); - Piecewise > n = rot90(unitVector(der)); + Piecewise > n = unitVector(der,0.0001); + n = rot90(n); offset_points.set_pwd2(pwd2_in, n); LineCapType end_linecap = static_cast(end_linecap_type.get_value()); @@ -583,7 +582,7 @@ LPEPowerStroke::doEffect_path (Geom::PathVector const & path_in) if (sort_points) { sort(ts.begin(), ts.end(), compare_offsets); } - if (path_in[0].closed()) { + if (pathv[0].closed()) { // add extra points for interpolation between first and last point Point first_point = ts.front(); Point last_point = ts.back(); @@ -605,7 +604,6 @@ LPEPowerStroke::doEffect_path (Geom::PathVector const & path_in) for (std::size_t i = 0, e = ts.size(); i < e; ++i) { ts[i][Geom::X] *= xcoord_scaling; } - // create stroke path where points (x,y) := (t, offset) Geom::Interpolate::Interpolator *interpolator = Geom::Interpolate::Interpolator::create(static_cast(interpolator_type.get_value())); if (Geom::Interpolate::CubicBezierJohan *johan = dynamic_cast(interpolator)) { @@ -631,7 +629,6 @@ LPEPowerStroke::doEffect_path (Geom::PathVector const & path_in) x = portion(x, rtsmin.at(0), rtsmax.at(0)); y = portion(y, rtsmin.at(0), rtsmax.at(0)); } - LineJoinType jointype = static_cast(linejoin_type.get_value()); Piecewise > pwd2_out = compose(pwd2_in,x) + y*compose(n,x); @@ -639,8 +636,7 @@ LPEPowerStroke::doEffect_path (Geom::PathVector const & path_in) Geom::Path fixed_path = path_from_piecewise_fix_cusps( pwd2_out, y, jointype, miter_limit, LPE_CONVERSION_TOLERANCE); Geom::Path fixed_mirrorpath = path_from_piecewise_fix_cusps( mirrorpath, reverse(y), jointype, miter_limit, LPE_CONVERSION_TOLERANCE); - - if (path_in[0].closed()) { + if (pathv[0].closed()) { fixed_path.close(true); path_out.push_back(fixed_path); fixed_mirrorpath.close(true); @@ -684,7 +680,6 @@ LPEPowerStroke::doEffect_path (Geom::PathVector const & path_in) } fixed_path.append(fixed_mirrorpath); - switch (start_linecap) { case LINECAP_ZERO_WIDTH: // do nothing @@ -720,11 +715,9 @@ LPEPowerStroke::doEffect_path (Geom::PathVector const & path_in) break; } } - fixed_path.close(true); path_out.push_back(fixed_path); } - return path_out; } diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index c98ecb686..7697cd59c 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -236,38 +236,14 @@ static void spdc_apply_powerstroke_shape(const std::vector & points Effect* lpe = SP_LPE_ITEM(item)->getCurrentLPE(); static_cast(lpe)->offset_points.param_set_and_write_new_value(points); - // find out stroke width (TODO: is there an easier way??) - SPDesktop *desktop = dc->desktop; - Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc(); - Inkscape::XML::Node *repr = xml_doc->createElement("svg:path"); - Inkscape::GC::release(repr); - - char const* tool = SP_IS_PEN_CONTEXT(dc) ? "/tools/freehand/pen" : "/tools/freehand/pencil"; - - // apply the tool's current style - sp_desktop_apply_style_tool(desktop, repr, tool, false); - - double stroke_width = 1.0; - char const *style_str = NULL; - style_str = repr->attribute("style"); - if (style_str) { - SPStyle style(SP_ACTIVE_DOCUMENT); - style.mergeString(style_str); - stroke_width = style.stroke_width.computed; - } - - std::ostringstream s; - s.imbue(std::locale::classic()); - s << points[0][Geom::X] << "," << stroke_width / 2.; - // write powerstroke parameters: lpe->getRepr()->setAttribute("start_linecap_type", "zerowidth"); lpe->getRepr()->setAttribute("end_linecap_type", "zerowidth"); - lpe->getRepr()->setAttribute("cusp_linecap_type", "round"); lpe->getRepr()->setAttribute("sort_points", "true"); lpe->getRepr()->setAttribute("interpolator_type", "CubicBezierJohan"); lpe->getRepr()->setAttribute("interpolator_beta", "0.2"); - lpe->getRepr()->setAttribute("offset_points", s.str().c_str()); + lpe->getRepr()->setAttribute("miter_limit", "4"); + lpe->getRepr()->setAttribute("linejoin_type", "extrp_arc"); } static void spdc_apply_bend_shape(gchar const *svgd, FreehandBase *dc, SPItem *item) @@ -341,12 +317,14 @@ static void spdc_check_for_and_apply_waiting_LPE(FreehandBase *dc, SPItem *item, bool shape_applied = false; SPCSSAttr *css_item = sp_css_attr_from_object(item, SP_STYLE_FLAG_ALWAYS); const char *cstroke = sp_repr_css_property(css_item, "stroke", "none"); + const char *stroke_width = sp_repr_css_property(css_item, "stroke-width", "0"); + double swidth; + sp_svg_number_read_d(stroke_width, &swidth); static SPItem *bend_item; #define SHAPE_LENGTH 10 #define SHAPE_HEIGHT 10 - if(shape == LAST_APPLIED){ shape = previous_shape_type; @@ -363,7 +341,8 @@ static void spdc_check_for_and_apply_waiting_LPE(FreehandBase *dc, SPItem *item, { // "triangle in" std::vector points(1); - points[0] = Geom::Point(0., SHAPE_HEIGHT/2); + points[0] = Geom::Point(0., swidth/2); + points[0] *= i2anc_affine(static_cast(item->parent), NULL).inverse(); spdc_apply_powerstroke_shape(points, dc, item); shape_applied = true; @@ -374,7 +353,9 @@ static void spdc_check_for_and_apply_waiting_LPE(FreehandBase *dc, SPItem *item, // "triangle out" guint curve_length = curve->get_segment_count(); std::vector points(1); - points[0] = Geom::Point((double)curve_length, SHAPE_HEIGHT/2); + points[0] = Geom::Point(0, swidth/2); + points[0] *= i2anc_affine(static_cast(item->parent), NULL).inverse(); + points[0][Geom::X] = (double)curve_length; spdc_apply_powerstroke_shape(points, dc, item); shape_applied = true; @@ -455,7 +436,6 @@ static void spdc_check_for_and_apply_waiting_LPE(FreehandBase *dc, SPItem *item, if(previous_shape_type == CLIPBOARD){ if(previous_shape_pathv.size() != 0){ spdc_paste_curve_as_freehand_shape(previous_shape_pathv, dc, item); - shape_applied = true; shape = CLIPBOARD; } else{ -- cgit v1.2.3 From 027da41d7212e9ecaf19439f91266d4888ae96e3 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Fri, 17 Jun 2016 08:14:16 +0200 Subject: Fixing wrong gettext keyword preventing translations from being used. (bzr r14992) --- src/ui/tools/measure-tool.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ui/tools/measure-tool.cpp b/src/ui/tools/measure-tool.cpp index 0977729ae..63e2460ec 100644 --- a/src/ui/tools/measure-tool.cpp +++ b/src/ui/tools/measure-tool.cpp @@ -346,13 +346,13 @@ MeasureTool::MeasureTool() end_p = readMeasurePoint(false); dimension_offset = 35; // create the knots - this->knot_start = new SPKnot(desktop, N_("Measure start, Shift+Click for position dialog")); + this->knot_start = new SPKnot(desktop, _("Measure start, Shift+Click for position dialog")); this->knot_start->setMode(SP_KNOT_MODE_XOR); this->knot_start->setFill(MT_KNOT_COLOR_NORMAL, MT_KNOT_COLOR_MOUSEOVER, MT_KNOT_COLOR_MOUSEOVER); this->knot_start->setStroke(0x0000007f, 0x0000007f, 0x0000007f); this->knot_start->setShape(SP_KNOT_SHAPE_CIRCLE); this->knot_start->updateCtrl(); - this->knot_end = new SPKnot(desktop, N_("Measure end, Shift+Click for position dialog")); + this->knot_end = new SPKnot(desktop, _("Measure end, Shift+Click for position dialog")); this->knot_end->setMode(SP_KNOT_MODE_XOR); this->knot_end->setFill(MT_KNOT_COLOR_NORMAL, MT_KNOT_COLOR_MOUSEOVER, MT_KNOT_COLOR_MOUSEOVER); this->knot_end->setStroke(0x0000007f, 0x0000007f, 0x0000007f); -- cgit v1.2.3 From b65581bd7a768c78115a8a0a807e79a2ee91e80e Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Mon, 20 Jun 2016 18:57:07 +0200 Subject: Fixing missing gettext keyword (regression introduced rev. 14057). (bzr r14997) --- src/widgets/paintbucket-toolbar.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/widgets/paintbucket-toolbar.cpp b/src/widgets/paintbucket-toolbar.cpp index eb55287c4..5cb2dd58b 100644 --- a/src/widgets/paintbucket-toolbar.cpp +++ b/src/widgets/paintbucket-toolbar.cpp @@ -127,7 +127,7 @@ void sp_paintbucket_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions iterator != channel_list.end(); ++iterator ) { GtkTreeIter iter; gtk_list_store_append( model, &iter ); - gtk_list_store_set( model, &iter, 0, (*iterator).c_str(), 1, count, -1 ); + gtk_list_store_set( model, &iter, 0, _((*iterator).c_str()), 1, count, -1 ); count++; } @@ -193,7 +193,7 @@ void sp_paintbucket_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions iterator != gap_list.end(); ++iterator ) { GtkTreeIter iter; gtk_list_store_append( model, &iter ); - gtk_list_store_set( model, &iter, 0, (*iterator).c_str(), 1, count, -1 ); + gtk_list_store_set( model, &iter, 0, _((*iterator).c_str()), 1, count, -1 ); count++; } EgeSelectOneAction* act2 = ege_select_one_action_new( "AutoGapAction", _("Close gaps"), (""), NULL, GTK_TREE_MODEL(model) ); -- cgit v1.2.3 From a2abc287716054efec7514b36e4ec6beb69400bc Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Thu, 23 Jun 2016 07:48:07 +0200 Subject: [Bug #1594542] Reset paint buckets parameters icon is not visible in Tool Controls Bar. Fixed bugs: - https://launchpad.net/bugs/1594542 (bzr r15001) --- src/widgets/paintbucket-toolbar.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/widgets/paintbucket-toolbar.cpp b/src/widgets/paintbucket-toolbar.cpp index 5cb2dd58b..b717d74fa 100644 --- a/src/widgets/paintbucket-toolbar.cpp +++ b/src/widgets/paintbucket-toolbar.cpp @@ -42,6 +42,7 @@ #include "ui/uxmanager.h" #include "ui/widget/unit-tracker.h" #include "util/units.h" +#include "widgets/ink-action.h" using Inkscape::UI::Widget::UnitTracker; using Inkscape::UI::UXManager; @@ -207,13 +208,14 @@ void sp_paintbucket_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions /* Reset */ { - GtkAction* act = gtk_action_new( "PaintbucketResetAction", + InkAction* inky = ink_action_new( "PaintbucketResetAction", _("Defaults"), _("Reset paint bucket parameters to defaults (use Inkscape Preferences > Tools to change defaults)"), - INKSCAPE_ICON("edit-clear")); - g_signal_connect_after( G_OBJECT(act), "activate", G_CALLBACK(paintbucket_defaults), holder ); - gtk_action_group_add_action( mainActions, act ); - gtk_action_set_sensitive( act, TRUE ); + INKSCAPE_ICON("edit-clear"), + Inkscape::ICON_SIZE_SMALL_TOOLBAR); + g_signal_connect_after( G_OBJECT(inky), "activate", G_CALLBACK(paintbucket_defaults), holder ); + gtk_action_group_add_action( mainActions, GTK_ACTION(inky) ); + gtk_action_set_sensitive( GTK_ACTION(inky), TRUE ); } } -- cgit v1.2.3 From a4ba7249e4e4510665860eebb43262b0ec7612b0 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 25 Jun 2016 20:55:14 +0200 Subject: Fix bug#168286 also opem regression on bug#1594565 Fixed bugs: - https://launchpad.net/bugs/168286 (bzr r15002) --- src/sp-item-group.cpp | 104 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 103 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index 83d67cf5a..70d2bc732 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -53,6 +53,10 @@ #include "layer-model.h" #include "sp-textpath.h" #include "sp-flowtext.h" +#include "sp-tspan.h" +#include "selection-chemistry.h" +#include "xml/sp-css-attr.h" +#include "svg/css-ostringstream.h" using Inkscape::DocumentUndo; @@ -388,6 +392,89 @@ void sp_item_group_ungroup_handle_clones(SPItem *parent, Geom::Affine const g) } } +void +sp_recursive_scale_text_size(Inkscape::XML::Node *repr, double scale){ + for (Inkscape::XML::Node *child = repr->firstChild() ; child; child = child->next() ){ + if ( child) { + sp_recursive_scale_text_size(child, scale); + } + } + SPCSSAttr * css = sp_repr_css_attr(repr,"style"); + Glib::ustring element = g_quark_to_string(repr->code()); + if (css && element == "svg:text" || element == "svg:tspan") { + gchar const *w = sp_repr_css_property(css, "font-size", NULL); + if (w) { + gchar *units = NULL; + double wd = g_ascii_strtod(w, &units); + wd *= scale; + if (w != units) { + Inkscape::CSSOStringStream os; + os << wd << units; // reattach units + sp_repr_css_set_property(css, "font-size", os.str().c_str()); + Glib::ustring css_str; + sp_repr_css_write_string(css,css_str); + repr->setAttribute("style", css_str.c_str()); + } + } + w = NULL; + w = sp_repr_css_property(css, "letter-spacing", NULL); + if (w) { + gchar *units = NULL; + double wd = g_ascii_strtod(w, &units); + wd *= scale; + if (w != units) { + Inkscape::CSSOStringStream os; + os << wd << units; // reattach units + sp_repr_css_set_property(css, "letter-spacing", os.str().c_str()); + Glib::ustring css_str; + sp_repr_css_write_string(css,css_str); + repr->setAttribute("style", css_str.c_str()); + } + } + w = NULL; + w = sp_repr_css_property(css, "word-spacing", NULL); + if (w) { + gchar *units = NULL; + double wd = g_ascii_strtod(w, &units); + wd *= scale; + if (w != units) { + Inkscape::CSSOStringStream os; + os << wd << units; // reattach units + sp_repr_css_set_property(css, "word-spacing", os.str().c_str()); + Glib::ustring css_str; + sp_repr_css_write_string(css,css_str); + repr->setAttribute("style", css_str.c_str()); + } + } + gchar const *dx = repr->attribute("dx"); + if (dx) { + gchar ** dxarray = g_strsplit(dx, " ", 0); + Inkscape::SVGOStringStream dx_data; + while (*dxarray != NULL) { + double pos; + sp_svg_number_read_d(*dxarray, &pos); + pos *= scale; + dx_data << pos << " "; + dxarray++; + } + repr->setAttribute("dx", dx_data.str().c_str()); + } + gchar const *dy = repr->attribute("dy"); + if (dy) { + gchar ** dyarray = g_strsplit(dy, " ", 0); + Inkscape::SVGOStringStream dy_data; + while (*dyarray != NULL) { + double pos; + sp_svg_number_read_d(*dyarray, &pos); + pos *= scale; + dy_data << pos << " "; + dyarray++; + } + repr->setAttribute("dy", dy_data.str().c_str()); + } + } +} + void sp_item_group_ungroup (SPGroup *group, std::vector &children, bool do_done) { @@ -492,7 +579,22 @@ sp_item_group_ungroup (SPGroup *group, std::vector &children, bool do_d // reattached outside of the group, the transform will be written more properly // (i.e. optimized into the object if the corresponding preference is set) gchar *affinestr=sp_svg_transform_write(ctrans); - nrepr->setAttribute("transform", affinestr); + SPText * text = dynamic_cast(citem); + if (text) { + //this causes a change in text-on-path appearance when there is a non-conformal transform, see bug #1594565 + double scale = (ctrans.expansionX() + ctrans.expansionY()) / 2.0; + SPTextPath * text_path = dynamic_cast(text->children); + if (!text_path) { + nrepr->setAttribute("transform", affinestr); + } else { + sp_recursive_scale_text_size(nrepr, scale); + Geom::Affine ttrans = ctrans.inverse() * SP_ITEM(text)->transform * ctrans; + gchar *affinestr = sp_svg_transform_write(ttrans); + nrepr->setAttribute("transform", affinestr); + } + } else { + nrepr->setAttribute("transform", affinestr); + } g_free(affinestr); items = g_slist_prepend (items, nrepr); -- cgit v1.2.3 From 0aca36171bd8c5c33823f839f594b8677d97c51d Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Wed, 29 Jun 2016 05:34:04 -0400 Subject: avoid zero SBasis curve. (Bug 1593963) Fixed bugs: - https://launchpad.net/bugs/1593963 (bzr r15003) --- src/2geom/sbasis-geometric.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/2geom/sbasis-geometric.cpp b/src/2geom/sbasis-geometric.cpp index 19eccc451..3fe27748e 100644 --- a/src/2geom/sbasis-geometric.cpp +++ b/src/2geom/sbasis-geometric.cpp @@ -227,7 +227,7 @@ Geom::unitVector(D2 const &V_in, double tol, unsigned order){ // -This approach is numerically bad. Find a stable way to rescale V_in to have non vanishing ends. // -This done, unitVector will have jumps at zeros: fill the gaps with arcs of circles. D2 V = RescaleForNonVanishingEnds(V_in); - if (V[0].isZero(0) && V[1].isZero(0)) + if (V[0].isZero(tol) && V[1].isZero(tol)) return Piecewise >(D2(Linear(1),SBasis())); SBasis x = V[0], y = V[1]; -- cgit v1.2.3 From 30e74d438ef362634967a47053ecf27fb950e340 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 2 Jul 2016 02:27:56 +0200 Subject: Fix bug #1598009 regression on path parameter Fixed bugs: - https://launchpad.net/bugs/1598009 (bzr r15004) --- src/live_effects/parameter/path.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp index bed191e83..f0c494267 100644 --- a/src/live_effects/parameter/path.cpp +++ b/src/live_effects/parameter/path.cpp @@ -237,7 +237,6 @@ PathParam::param_editOncanvas(SPItem *item, SPDesktop * dt) r.role = SHAPE_ROLE_LPE_PARAM; r.edit_transform = item->i2dt_affine(); // TODO is it right? - r.edit_transform *= item->transform.inverse(); if (!href) { r.item = reinterpret_cast(param_effect->getLPEObj()); r.lpe_key = param_key; @@ -458,8 +457,7 @@ PathParam::paste_param_path(const char *svgd) SPItem * item = SP_ACTIVE_DESKTOP->getSelection()->singleItem(); if (item != NULL) { Geom::PathVector path_clipboard = sp_svg_read_pathv(svgd); - path_clipboard *= item->i2doc_affine().inverse() * item->transform; - path_clipboard *= Geom::Translate(path_clipboard.initialPoint() - _pathvector.initialPoint()).inverse(); + path_clipboard *= item->i2doc_affine().inverse(); svgd = sp_svg_write_path( path_clipboard ); } -- cgit v1.2.3 From fefc3d571319771e1ee9e6c6f161d29882e7d7ab Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sat, 2 Jul 2016 14:48:19 +0200 Subject: Fix typo from GList purge that broke SVG Font Editor dialog. (bzr r15005) --- src/ui/dialog/svg-fonts-dialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index 790c0e5fb..e96eec5bb 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -266,7 +266,7 @@ void SvgFontsDialog::update_fonts() { SPDesktop* desktop = this->getDesktop(); SPDocument* document = desktop->getDocument(); - std::vector fonts = document->getResourceList( "fonts" ); + std::vector fonts = document->getResourceList( "font" ); _model->clear(); for (std::vector::const_iterator it = fonts.begin(); it != fonts.end(); ++it) { -- cgit v1.2.3 From aeb705274cc983200011d453643d5e3a6d2fd5f9 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sat, 2 Jul 2016 15:53:33 +0200 Subject: Rename function, fix some indenting issues. (bzr r15006) --- src/ui/dialog/svg-fonts-dialog.cpp | 4 +- src/ui/dialog/svg-fonts-dialog.h | 206 +++++++++++++++++++------------------ 2 files changed, 110 insertions(+), 100 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index e96eec5bb..a39955123 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -340,7 +340,7 @@ void SvgFontsDialog::on_font_selection_changed(){ update_sensitiveness(); } -void SvgFontsDialog::on_setwidth_changed(){ +void SvgFontsDialog::on_setfontdata_changed(){ SPFont* spfont = this->get_selected_spfont(); if (spfont){ spfont->horiz_adv_x = setwidth_spin.get_value(); @@ -397,7 +397,7 @@ Gtk::VBox* SvgFontsDialog::global_settings_tab(){ setwidth_hbox->add(*Gtk::manage(new Gtk::Label(_("Set width:")))); setwidth_hbox->add(setwidth_spin); - setwidth_spin.signal_changed().connect(sigc::mem_fun(*this, &SvgFontsDialog::on_setwidth_changed)); + setwidth_spin.signal_changed().connect(sigc::mem_fun(*this, &SvgFontsDialog::on_setfontdata_changed)); setwidth_spin.set_range(0, 4096); setwidth_spin.set_increments(10, 0); global_vbox.pack_start(*setwidth_hbox, false, false); diff --git a/src/ui/dialog/svg-fonts-dialog.h b/src/ui/dialog/svg-fonts-dialog.h index e5c4631e4..e80bbfd39 100644 --- a/src/ui/dialog/svg-fonts-dialog.h +++ b/src/ui/dialog/svg-fonts-dialog.h @@ -69,64 +69,63 @@ public: SvgFontsDialog(); ~SvgFontsDialog(); - static SvgFontsDialog &getInstance() - { return *new SvgFontsDialog(); } + static SvgFontsDialog &getInstance() { return *new SvgFontsDialog(); } void update_fonts(); SvgFont* get_selected_svgfont(); SPFont* get_selected_spfont(); - SPGlyph* get_selected_glyph(); - SPGlyphKerning* get_selected_kerning_pair(); + SPGlyph* get_selected_glyph(); + SPGlyphKerning* get_selected_kerning_pair(); - //TODO: these methods should be private, right?! + //TODO: these methods should be private, right?! void on_font_selection_changed(); - void on_kerning_pair_selection_changed(); + void on_kerning_pair_selection_changed(); void on_preview_text_changed(); void on_kerning_pair_changed(); void on_kerning_value_changed(); - void on_setwidth_changed(); - void add_font(); - Geom::PathVector flip_coordinate_system(Geom::PathVector pathv); + void on_setfontdata_changed(); + void add_font(); + Geom::PathVector flip_coordinate_system(Geom::PathVector pathv); - //TODO: AttrEntry is currently unused. Should we remove it? + //TODO: AttrEntry is currently unused. Should we remove it? class AttrEntry : public Gtk::HBox - { - public: - AttrEntry(SvgFontsDialog* d, gchar* lbl, const SPAttributeEnum attr); - void set_text(char*); - private: - SvgFontsDialog* dialog; - void on_attr_changed(); - Gtk::Entry entry; - SPAttributeEnum attr; + { + public: + AttrEntry(SvgFontsDialog* d, gchar* lbl, const SPAttributeEnum attr); + void set_text(char*); + private: + SvgFontsDialog* dialog; + void on_attr_changed(); + Gtk::Entry entry; + SPAttributeEnum attr; }; private: - void update_glyphs(); - void update_sensitiveness(); - void update_global_settings_tab(); - void populate_glyphs_box(); + void update_glyphs(); + void update_sensitiveness(); + void update_global_settings_tab(); + void populate_glyphs_box(); void populate_kerning_pairs_box(); - void set_glyph_description_from_selected_path(); - void missing_glyph_description_from_selected_path(); - void reset_missing_glyph_description(); - void add_glyph(); - void glyph_unicode_edit(const Glib::ustring&, const Glib::ustring&); - void glyph_name_edit(const Glib::ustring&, const Glib::ustring&); - void remove_selected_glyph(); - void remove_selected_font(); - void remove_selected_kerning_pair(); + void set_glyph_description_from_selected_path(); + void missing_glyph_description_from_selected_path(); + void reset_missing_glyph_description(); + void add_glyph(); + void glyph_unicode_edit(const Glib::ustring&, const Glib::ustring&); + void glyph_name_edit(const Glib::ustring&, const Glib::ustring&); + void remove_selected_glyph(); + void remove_selected_font(); + void remove_selected_kerning_pair(); - void add_kerning_pair(); + void add_kerning_pair(); - void create_glyphs_popup_menu(Gtk::Widget& parent, sigc::slot rem); - void glyphs_list_button_release(GdkEventButton* event); + void create_glyphs_popup_menu(Gtk::Widget& parent, sigc::slot rem); + void glyphs_list_button_release(GdkEventButton* event); - void create_fonts_popup_menu(Gtk::Widget& parent, sigc::slot rem); - void fonts_list_button_release(GdkEventButton* event); + void create_fonts_popup_menu(Gtk::Widget& parent, sigc::slot rem); + void fonts_list_button_release(GdkEventButton* event); - void create_kerning_pairs_popup_menu(Gtk::Widget& parent, sigc::slot rem); - void kerning_pairs_list_button_release(GdkEventButton* event); + void create_kerning_pairs_popup_menu(Gtk::Widget& parent, sigc::slot rem); + void kerning_pairs_list_button_release(GdkEventButton* event); Inkscape::XML::SignalObserver _defs_observer; //in order to update fonts Inkscape::XML::SignalObserver _glyphs_observer; @@ -134,47 +133,47 @@ private: Gtk::HBox* AttrCombo(gchar* lbl, const SPAttributeEnum attr); // Gtk::HBox* AttrSpin(gchar* lbl, const SPAttributeEnum attr); Gtk::VBox* global_settings_tab(); - AttrEntry* _familyname_entry; + AttrEntry* _familyname_entry; Gtk::VBox* kerning_tab(); Gtk::VBox* glyphs_tab(); Gtk::Button _add; Gtk::Button add_glyph_button; - Gtk::Button glyph_from_path_button; - Gtk::Button missing_glyph_button; - Gtk::Button missing_glyph_reset_button; + Gtk::Button glyph_from_path_button; + Gtk::Button missing_glyph_button; + Gtk::Button missing_glyph_reset_button; class Columns : public Gtk::TreeModel::ColumnRecord - { - public: - Columns() - { - add(spfont); - add(svgfont); - add(label); - } - - Gtk::TreeModelColumn spfont; - Gtk::TreeModelColumn svgfont; - Gtk::TreeModelColumn label; + { + public: + Columns() + { + add(spfont); + add(svgfont); + add(label); + } + + Gtk::TreeModelColumn spfont; + Gtk::TreeModelColumn svgfont; + Gtk::TreeModelColumn label; }; Glib::RefPtr _model; Columns _columns; Gtk::TreeView _FontsList; class GlyphsColumns : public Gtk::TreeModel::ColumnRecord - { - public: - GlyphsColumns() - { - add(glyph_node); - add(glyph_name); - add(unicode); - } - - Gtk::TreeModelColumn glyph_node; - Gtk::TreeModelColumn glyph_name; - Gtk::TreeModelColumn unicode; + { + public: + GlyphsColumns() + { + add(glyph_node); + add(glyph_name); + add(unicode); + } + + Gtk::TreeModelColumn glyph_node; + Gtk::TreeModelColumn glyph_name; + Gtk::TreeModelColumn unicode; }; GlyphsColumns _GlyphsListColumns; Glib::RefPtr _GlyphsListStore; @@ -182,30 +181,30 @@ private: Gtk::ScrolledWindow _GlyphsListScroller; class KerningPairColumns : public Gtk::TreeModel::ColumnRecord - { - public: - KerningPairColumns() - { - add(first_glyph); - add(second_glyph); - add(kerning_value); - add(spnode); - } - - Gtk::TreeModelColumn first_glyph; - Gtk::TreeModelColumn second_glyph; - Gtk::TreeModelColumn kerning_value; - Gtk::TreeModelColumn spnode; + { + public: + KerningPairColumns() + { + add(first_glyph); + add(second_glyph); + add(kerning_value); + add(spnode); + } + + Gtk::TreeModelColumn first_glyph; + Gtk::TreeModelColumn second_glyph; + Gtk::TreeModelColumn kerning_value; + Gtk::TreeModelColumn spnode; }; KerningPairColumns _KerningPairsListColumns; Glib::RefPtr _KerningPairsListStore; Gtk::TreeView _KerningPairsList; Gtk::ScrolledWindow _KerningPairsListScroller; - Gtk::Button add_kernpair_button; + Gtk::Button add_kernpair_button; Gtk::VBox _font_settings; - Gtk::VBox global_vbox; - Gtk::VBox glyphs_vbox; + Gtk::VBox global_vbox; + Gtk::VBox glyphs_vbox; Gtk::VBox kerning_vbox; Gtk::Entry _preview_entry; @@ -225,20 +224,20 @@ private: #endif class EntryWidget : public Gtk::HBox - { - public: - EntryWidget() - { - this->add(this->_label); - this->add(this->_entry); - } - void set_label(const gchar* l){ - this->_label.set_text(l); - } - private: - Gtk::Label _label; - Gtk::Entry _entry; - }; + { + public: + EntryWidget() + { + this->add(this->_label); + this->add(this->_entry); + } + void set_label(const gchar* l){ + this->_label.set_text(l); + } + private: + Gtk::Label _label; + Gtk::Entry _entry; + }; EntryWidget _font_family, _font_variant; }; @@ -247,3 +246,14 @@ private: } // namespace Inkscape #endif //#ifndef INKSCAPE_UI_DIALOG_SVG_FONTS_H + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : -- cgit v1.2.3 From 495ac0773c4341589f1cd9108c9de3daf5b78c2c Mon Sep 17 00:00:00 2001 From: Sebastian Faubel Date: Sat, 2 Jul 2016 19:15:39 +0200 Subject: Merge with trunk. (bzr r15002.1.1) --- src/CMakeLists.txt | 64 ++++++++++++++++++++---------------------------------- 1 file changed, 24 insertions(+), 40 deletions(-) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 66f16b7fb..d979d7c13 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,10 +2,6 @@ # Define the main source # ----------------------------------------------------------------------------- -set(main_SRC - main.cpp -) - set(sp_SRC attribute-rel-css.cpp attribute-rel-svg.cpp @@ -423,21 +419,6 @@ set(inkscape_SRC version.h ) -if(WIN32) - list(APPEND inkscape_SRC - inkscape.rc - registrytool.cpp - #deptool.cpp - winconsole.cpp - winmain.cpp - - # ------- - # Headers - registrytool.h - ) -endif() - - # ----------------------------------------------------------------------------- # Generate version file # ----------------------------------------------------------------------------- @@ -481,7 +462,6 @@ add_subdirectory(widgets) add_subdirectory(xml) add_subdirectory(2geom) - # Directories containing lists files that describe building internal libraries add_subdirectory(libavoid) add_subdirectory(libcola) @@ -494,7 +474,6 @@ add_subdirectory(livarot) add_subdirectory(libnrtype) add_subdirectory(libdepixelize) - get_property(inkscape_global_SRC GLOBAL PROPERTY inkscape_global_SRC) set(inkscape_SRC @@ -508,12 +487,32 @@ set(inkscape_SRC #add_inkscape_lib(sp_LIB "${sp_SRC}") #add_inkscape_lib(inkscape_LIB "${inkscape_SRC}") +if(WIN32) + # Sources for the inkscape executable on Windows. + set(main_SRC + registrytool.h + registrytool.cpp + main.cpp + winmain.cpp + #winconsole.cpp + ) + + # Add the platform specific resource files (enabling the app icon). + if(${HAVE_MINGW64}) + list(APPEND main_SRC inkscape-x64.rc) + else() + list(APPEND main_SRC inkscape.rc) + endif() +else() + set(main_SRC main.cpp) +endif() + # Build everything except main and inkview.c in a shared library. add_library(inkscape_base SHARED ${inkscape_SRC} ${sp_SRC}) # make executables for inkscape and inkview -add_executable(inkscape ${main_SRC} ) -add_executable(inkview inkview.cpp ) +add_executable(inkscape ${main_SRC}) +add_executable(inkview inkview.cpp) add_dependencies(inkscape inkscape_version) @@ -525,11 +524,9 @@ set(INKSCAPE_TARGET_LIBS # 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 cola_LIB @@ -548,22 +545,9 @@ if (NOT "${WITH_EXT_GDL}") list (INSERT INKSCAPE_TARGET_LIBS 0 "gdl_LIB") endif() - - - # Link the inkscape_base library against all external dependencies target_link_libraries(inkscape_base ${INKSCAPE_TARGET_LIBS}) # Link inkscape and inkview against inkscape_base -target_link_libraries(inkscape inkscape_base ) -target_link_libraries(inkview inkscape_base) - -#Define the installation -install( - TARGETS inkscape_base inkscape inkview - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib/inkscape - ARCHIVE DESTINATION lib/inkscape - ) - - +target_link_libraries(inkscape inkscape_base) +target_link_libraries(inkview inkscape_base) \ No newline at end of file -- cgit v1.2.3 From f5c74e3a9d4e23e6cc86851b426dd05958e907ee Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Mon, 4 Jul 2016 14:30:44 +0200 Subject: Prevent data-losing crash when sorting attributes and Layer dialog open. (bzr r15007) --- src/attribute-sort-util.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/attribute-sort-util.cpp b/src/attribute-sort-util.cpp index d0f45c418..5c01f7914 100644 --- a/src/attribute-sort-util.cpp +++ b/src/attribute-sort-util.cpp @@ -105,12 +105,17 @@ void sp_attribute_sort_element(Node *repr) { //for (auto it: my_list) { for (std::vector >::iterator it = my_list.begin(); it != my_list.end(); ++it) { - repr->setAttribute( it->first.c_str(), NULL, false ); + // Removing "inkscape:label" results in crash when Layers dialog is open. + if (it->first != "inkscape:label") { + repr->setAttribute( it->first.c_str(), NULL, false ); + } } // Insert all attributes in proper order for (std::vector >::iterator it = my_list.begin(); it != my_list.end(); ++it) { - repr->setAttribute( it->first.c_str(), it->second.c_str(), false ); + if (it->first != "inkscape:label") { + repr->setAttribute( it->first.c_str(), it->second.c_str(), false ); + } } } -- cgit v1.2.3 From be79b33c0c55628f347f2a8418cbd54997050920 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Mon, 4 Jul 2016 16:47:05 +0200 Subject: Fix typo that prevents reading of 'units-per-em'. (bzr r15008) --- src/ui/dialog/svg-fonts-dialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index a39955123..08ebbcf14 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -497,7 +497,7 @@ SvgFontsDialog::flip_coordinate_system(Geom::PathVector pathv){ for (obj = get_selected_spfont()->children; obj; obj=obj->next){ if (SP_IS_FONTFACE(obj)){ //XML Tree being directly used here while it shouldn't be. - sp_repr_get_double(obj->getRepr(), "units_per_em", &units_per_em); + sp_repr_get_double(obj->getRepr(), "units-per-em", &units_per_em); } } -- cgit v1.2.3 From 7b0f2601a652adb7566bfac6ec0eab7a9d95c7a2 Mon Sep 17 00:00:00 2001 From: Sebastian Faubel Date: Wed, 6 Jul 2016 17:42:00 +0200 Subject: Fixing build for Linux. Replaced tabs with whitespaces. (bzr r15002.1.7) --- src/CMakeLists.txt | 883 +++++++++++++++++++++++++++-------------------------- 1 file changed, 447 insertions(+), 436 deletions(-) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d979d7c13..d4ba9b1f0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,420 +3,420 @@ # ----------------------------------------------------------------------------- set(sp_SRC - attribute-rel-css.cpp - attribute-rel-svg.cpp - attribute-rel-util.cpp - attribute-sort-util.cpp - sp-anchor.cpp - sp-clippath.cpp - sp-conn-end-pair.cpp - sp-conn-end.cpp - sp-cursor.cpp - sp-defs.cpp - sp-desc.cpp - sp-ellipse.cpp - sp-factory.cpp - sp-filter-primitive.cpp - sp-filter-reference.cpp - sp-filter.cpp - sp-flowdiv.cpp - sp-flowregion.cpp - sp-flowtext.cpp - sp-font-face.cpp - sp-font.cpp - sp-glyph-kerning.cpp - sp-glyph.cpp - sp-gradient-reference.cpp - sp-gradient.cpp - sp-guide.cpp - sp-hatch-path.cpp - sp-hatch.cpp - sp-image.cpp - sp-item-group.cpp - sp-item-notify-moveto.cpp - sp-item-rm-unsatisfied-cns.cpp - sp-item-transform.cpp - sp-item-update-cns.cpp - sp-item.cpp - sp-line.cpp - sp-linear-gradient.cpp - sp-lpe-item.cpp - sp-marker.cpp - sp-mask.cpp - sp-mesh-array.cpp - sp-mesh-patch.cpp - sp-mesh-row.cpp - sp-mesh.cpp - sp-metadata.cpp - sp-missing-glyph.cpp - sp-namedview.cpp - sp-object-group.cpp - sp-object.cpp - sp-offset.cpp - sp-paint-server.cpp - sp-path.cpp - sp-pattern.cpp - sp-polygon.cpp - sp-polyline.cpp - sp-radial-gradient.cpp - sp-rect.cpp - sp-root.cpp - sp-script.cpp - sp-shape.cpp - sp-solid-color.cpp - sp-spiral.cpp - sp-star.cpp - sp-stop.cpp - sp-string.cpp - sp-style-elem.cpp - sp-switch.cpp - sp-symbol.cpp - sp-tag-use-reference.cpp - sp-tag-use.cpp - sp-tag.cpp - sp-text.cpp - sp-title.cpp - sp-tref-reference.cpp - sp-tref.cpp - sp-tspan.cpp - sp-use-reference.cpp - sp-use.cpp - splivarot.cpp - viewbox.cpp + attribute-rel-css.cpp + attribute-rel-svg.cpp + attribute-rel-util.cpp + attribute-sort-util.cpp + sp-anchor.cpp + sp-clippath.cpp + sp-conn-end-pair.cpp + sp-conn-end.cpp + sp-cursor.cpp + sp-defs.cpp + sp-desc.cpp + sp-ellipse.cpp + sp-factory.cpp + sp-filter-primitive.cpp + sp-filter-reference.cpp + sp-filter.cpp + sp-flowdiv.cpp + sp-flowregion.cpp + sp-flowtext.cpp + sp-font-face.cpp + sp-font.cpp + sp-glyph-kerning.cpp + sp-glyph.cpp + sp-gradient-reference.cpp + sp-gradient.cpp + sp-guide.cpp + sp-hatch-path.cpp + sp-hatch.cpp + sp-image.cpp + sp-item-group.cpp + sp-item-notify-moveto.cpp + sp-item-rm-unsatisfied-cns.cpp + sp-item-transform.cpp + sp-item-update-cns.cpp + sp-item.cpp + sp-line.cpp + sp-linear-gradient.cpp + sp-lpe-item.cpp + sp-marker.cpp + sp-mask.cpp + sp-mesh-array.cpp + sp-mesh-patch.cpp + sp-mesh-row.cpp + sp-mesh.cpp + sp-metadata.cpp + sp-missing-glyph.cpp + sp-namedview.cpp + sp-object-group.cpp + sp-object.cpp + sp-offset.cpp + sp-paint-server.cpp + sp-path.cpp + sp-pattern.cpp + sp-polygon.cpp + sp-polyline.cpp + sp-radial-gradient.cpp + sp-rect.cpp + sp-root.cpp + sp-script.cpp + sp-shape.cpp + sp-solid-color.cpp + sp-spiral.cpp + sp-star.cpp + sp-stop.cpp + sp-string.cpp + sp-style-elem.cpp + sp-switch.cpp + sp-symbol.cpp + sp-tag-use-reference.cpp + sp-tag-use.cpp + sp-tag.cpp + sp-text.cpp + sp-title.cpp + sp-tref-reference.cpp + sp-tref.cpp + sp-tspan.cpp + sp-use-reference.cpp + sp-use.cpp + splivarot.cpp + viewbox.cpp - # ------- - # Headers - attribute-rel-css.h - attribute-rel-svg.h - attribute-rel-util.h - attribute-sort-util.h - sp-anchor.h - sp-clippath.h - sp-conn-end-pair.h - sp-conn-end.h - sp-cursor.h - sp-defs.h - sp-desc.h - sp-ellipse.h - sp-factory.h - sp-filter-primitive.h - sp-filter-reference.h - sp-filter-units.h - sp-filter.h - sp-flowdiv.h - sp-flowregion.h - sp-flowtext.h - sp-font-face.h - sp-font.h - sp-glyph-kerning.h - sp-glyph.h - sp-gradient-reference.h - sp-gradient-spread.h - sp-gradient-test.h - sp-gradient-units.h - sp-gradient-vector.h - sp-gradient.h - sp-guide-attachment.h - sp-guide-constraint.h - sp-guide.h - sp-hatch-path.h - sp-hatch.h - sp-image.h - sp-item-group.h - sp-item-notify-moveto.h - sp-item-rm-unsatisfied-cns.h - sp-item-transform.h - sp-item-update-cns.h - sp-item.h - sp-line.h - sp-linear-gradient.h - sp-lpe-item.h - sp-marker-loc.h - sp-marker.h - sp-mask.h - sp-mesh-array.h - sp-mesh-patch.h - sp-mesh-row.h - sp-mesh.h - sp-metadata.h - sp-missing-glyph.h - sp-namedview.h - sp-object-group.h - sp-object.h - sp-offset.h - sp-paint-server-reference.h - sp-paint-server.h - sp-path.h - sp-pattern.h - sp-polygon.h - sp-polyline.h - sp-radial-gradient.h - sp-rect.h - sp-root.h - sp-script.h - sp-shape.h - sp-solid-color.h - sp-spiral.h - sp-star.h - sp-stop.h - sp-string.h - sp-style-elem-test.h - sp-style-elem.h - sp-switch.h - sp-symbol.h - sp-tag.h - sp-tag-use.h - sp-tag-use-reference.h - sp-text.h - sp-textpath.h - sp-title.h - sp-tref-reference.h - sp-tref.h - sp-tspan.h - sp-use-reference.h - sp-use.h - viewbox.h + # ------- + # Headers + attribute-rel-css.h + attribute-rel-svg.h + attribute-rel-util.h + attribute-sort-util.h + sp-anchor.h + sp-clippath.h + sp-conn-end-pair.h + sp-conn-end.h + sp-cursor.h + sp-defs.h + sp-desc.h + sp-ellipse.h + sp-factory.h + sp-filter-primitive.h + sp-filter-reference.h + sp-filter-units.h + sp-filter.h + sp-flowdiv.h + sp-flowregion.h + sp-flowtext.h + sp-font-face.h + sp-font.h + sp-glyph-kerning.h + sp-glyph.h + sp-gradient-reference.h + sp-gradient-spread.h + sp-gradient-test.h + sp-gradient-units.h + sp-gradient-vector.h + sp-gradient.h + sp-guide-attachment.h + sp-guide-constraint.h + sp-guide.h + sp-hatch-path.h + sp-hatch.h + sp-image.h + sp-item-group.h + sp-item-notify-moveto.h + sp-item-rm-unsatisfied-cns.h + sp-item-transform.h + sp-item-update-cns.h + sp-item.h + sp-line.h + sp-linear-gradient.h + sp-lpe-item.h + sp-marker-loc.h + sp-marker.h + sp-mask.h + sp-mesh-array.h + sp-mesh-patch.h + sp-mesh-row.h + sp-mesh.h + sp-metadata.h + sp-missing-glyph.h + sp-namedview.h + sp-object-group.h + sp-object.h + sp-offset.h + sp-paint-server-reference.h + sp-paint-server.h + sp-path.h + sp-pattern.h + sp-polygon.h + sp-polyline.h + sp-radial-gradient.h + sp-rect.h + sp-root.h + sp-script.h + sp-shape.h + sp-solid-color.h + sp-spiral.h + sp-star.h + sp-stop.h + sp-string.h + sp-style-elem-test.h + sp-style-elem.h + sp-switch.h + sp-symbol.h + sp-tag.h + sp-tag-use.h + sp-tag-use-reference.h + sp-text.h + sp-textpath.h + sp-title.h + sp-tref-reference.h + sp-tref.h + sp-tspan.h + sp-use-reference.h + sp-use.h + viewbox.h ) set(inkscape_SRC - attributes.cpp - axis-manip.cpp - box3d-side.cpp - box3d.cpp - color-profile.cpp - color.cpp - composite-undo-stack-observer.cpp - conditions.cpp - conn-avoid-ref.cpp - console-output-undo-observer.cpp - context-fns.cpp - desktop-events.cpp - desktop-style.cpp - desktop.cpp - device-manager.cpp - dir-util.cpp - document-subset.cpp - document-undo.cpp - document.cpp - ege-color-prof-tracker.cpp - event-log.cpp - extract-uri.cpp - file.cpp - filter-chemistry.cpp - filter-enums.cpp - gc-anchored.cpp - gc-finalized.cpp - gradient-chemistry.cpp - gradient-drag.cpp - graphlayout.cpp - guide-snapper.cpp - help.cpp - id-clash.cpp - inkscape.cpp - knot-holder-entity.cpp - knot-ptr.cpp - knot.cpp - knotholder.cpp - layer-fns.cpp - layer-manager.cpp - layer-model.cpp - line-geometry.cpp - line-snapper.cpp - main-cmdlineact.cpp - media.cpp - message-context.cpp - message-stack.cpp - mod360.cpp - object-hierarchy.cpp - object-snapper.cpp - path-chemistry.cpp - persp3d-reference.cpp - persp3d.cpp - perspective-line.cpp - preferences.cpp - prefix.cpp - print.cpp - profile-manager.cpp - proj_pt.cpp - pure-transform.cpp - rdf.cpp - removeoverlap.cpp - resource-manager.cpp - rubberband.cpp - satisfied-guide-cns.cpp - selcue.cpp - selection-chemistry.cpp - selection-describer.cpp - selection.cpp - seltrans-handles.cpp - seltrans.cpp - shortcuts.cpp - snap-preferences.cpp - snap.cpp - snapped-curve.cpp - snapped-line.cpp - snapped-point.cpp - snapper.cpp - style-internal.cpp - style.cpp - svg-view-widget.cpp - svg-view.cpp - text-chemistry.cpp - text-editing.cpp - transf_mat_3x4.cpp - unclump.cpp - unicoderange.cpp - uri-references.cpp - uri.cpp - vanishing-point.cpp - verbs.cpp - version.cpp + attributes.cpp + axis-manip.cpp + box3d-side.cpp + box3d.cpp + color-profile.cpp + color.cpp + composite-undo-stack-observer.cpp + conditions.cpp + conn-avoid-ref.cpp + console-output-undo-observer.cpp + context-fns.cpp + desktop-events.cpp + desktop-style.cpp + desktop.cpp + device-manager.cpp + dir-util.cpp + document-subset.cpp + document-undo.cpp + document.cpp + ege-color-prof-tracker.cpp + event-log.cpp + extract-uri.cpp + file.cpp + filter-chemistry.cpp + filter-enums.cpp + gc-anchored.cpp + gc-finalized.cpp + gradient-chemistry.cpp + gradient-drag.cpp + graphlayout.cpp + guide-snapper.cpp + help.cpp + id-clash.cpp + inkscape.cpp + knot-holder-entity.cpp + knot-ptr.cpp + knot.cpp + knotholder.cpp + layer-fns.cpp + layer-manager.cpp + layer-model.cpp + line-geometry.cpp + line-snapper.cpp + main-cmdlineact.cpp + media.cpp + message-context.cpp + message-stack.cpp + mod360.cpp + object-hierarchy.cpp + object-snapper.cpp + path-chemistry.cpp + persp3d-reference.cpp + persp3d.cpp + perspective-line.cpp + preferences.cpp + prefix.cpp + print.cpp + profile-manager.cpp + proj_pt.cpp + pure-transform.cpp + rdf.cpp + removeoverlap.cpp + resource-manager.cpp + rubberband.cpp + satisfied-guide-cns.cpp + selcue.cpp + selection-chemistry.cpp + selection-describer.cpp + selection.cpp + seltrans-handles.cpp + seltrans.cpp + shortcuts.cpp + snap-preferences.cpp + snap.cpp + snapped-curve.cpp + snapped-line.cpp + snapped-point.cpp + snapper.cpp + style-internal.cpp + style.cpp + svg-view-widget.cpp + svg-view.cpp + text-chemistry.cpp + text-editing.cpp + transf_mat_3x4.cpp + unclump.cpp + unicoderange.cpp + uri-references.cpp + uri.cpp + vanishing-point.cpp + verbs.cpp + version.cpp - # ------- - # Headers - MultiPrinter.h - PylogFormatter.h - TRPIFormatter.h - attributes-test.h - attributes.h - axis-manip.h - bad-uri-exception.h - box3d-side.h - box3d.h - cms-color-types.h - cms-system.h - color-profile-cms-fns.h - color-profile-test.h - color-profile.h - color-rgba.h - color.h - colorspace.h - composite-undo-stack-observer.h - conditions.h - conn-avoid-ref.h - console-output-undo-observer.h - context-fns.h - decimal-round.h - desktop-events.h - desktop-style.h - desktop.h - device-manager.h - dir-util-test.h - dir-util.h - document-private.h - document-subset.h - document-undo.h - document.h - ege-color-prof-tracker.h - enums.h - event-log.h - event.h - extract-uri-test.h - extract-uri.h - file.h - fill-or-stroke.h - filter-chemistry.h - filter-enums.h - gc-anchored.h - gc-finalized.h - gradient-chemistry.h - gradient-drag.h - graphlayout.h - guide-snapper.h - help.h - helper-fns.h - icon-size.h - id-clash.h - inkscape-version.h - inkscape.h - isinf.h - knot-enums.h - knot-holder-entity.h - knot-ptr.h - knot.h - knotholder.h - layer-fns.h - layer-manager.h - layer-model.h - line-geometry.h - line-snapper.h - macros.h - main-cmdlineact.h - marker-test.h - media.h - menus-skeleton.h - message-context.h - message-stack.h - message.h - mod360-test.h - mod360.h - number-opt-number.h - object-hierarchy.h - object-snapper.h - object-test.h - path-chemistry.h - path-prefix.h - persp3d-reference.h - persp3d.h - perspective-line.h - preferences-skeleton.h - preferences-test.h - preferences.h - prefix.h - print.h - profile-manager.h - proj_pt.h - pure-transform.h - rdf.h - remove-last.h - removeoverlap.h - require-config.h - resource-manager.h - round-test.h - round.h - rubberband.h - satisfied-guide-cns.h - selcue.h - selection-chemistry.h - selection-describer.h - selection.h - seltrans-handles.h - seltrans.h - shortcuts.h - snap-candidate.h - snap-enums.h - snap-preferences.h - snap.h - snapped-curve.h - snapped-line.h - snapped-point.h - snapper.h - splivarot.h - streq.h - strneq.h - style-enums.h - style-internal.h - style-test.h - style.h - svg-profile.h - svg-view-widget.h - svg-view.h - syseq.h - test-helpers.h - text-chemistry.h - text-editing.h - text-tag-attributes.h - transf_mat_3x4.h - unclump.h - undo-stack-observer.h - unicoderange.h - uri-references.h - uri-test.h - uri.h - vanishing-point.h - verbs-test.h - verbs.h - version.h + # ------- + # Headers + MultiPrinter.h + PylogFormatter.h + TRPIFormatter.h + attributes-test.h + attributes.h + axis-manip.h + bad-uri-exception.h + box3d-side.h + box3d.h + cms-color-types.h + cms-system.h + color-profile-cms-fns.h + color-profile-test.h + color-profile.h + color-rgba.h + color.h + colorspace.h + composite-undo-stack-observer.h + conditions.h + conn-avoid-ref.h + console-output-undo-observer.h + context-fns.h + decimal-round.h + desktop-events.h + desktop-style.h + desktop.h + device-manager.h + dir-util-test.h + dir-util.h + document-private.h + document-subset.h + document-undo.h + document.h + ege-color-prof-tracker.h + enums.h + event-log.h + event.h + extract-uri-test.h + extract-uri.h + file.h + fill-or-stroke.h + filter-chemistry.h + filter-enums.h + gc-anchored.h + gc-finalized.h + gradient-chemistry.h + gradient-drag.h + graphlayout.h + guide-snapper.h + help.h + helper-fns.h + icon-size.h + id-clash.h + inkscape-version.h + inkscape.h + isinf.h + knot-enums.h + knot-holder-entity.h + knot-ptr.h + knot.h + knotholder.h + layer-fns.h + layer-manager.h + layer-model.h + line-geometry.h + line-snapper.h + macros.h + main-cmdlineact.h + marker-test.h + media.h + menus-skeleton.h + message-context.h + message-stack.h + message.h + mod360-test.h + mod360.h + number-opt-number.h + object-hierarchy.h + object-snapper.h + object-test.h + path-chemistry.h + path-prefix.h + persp3d-reference.h + persp3d.h + perspective-line.h + preferences-skeleton.h + preferences-test.h + preferences.h + prefix.h + print.h + profile-manager.h + proj_pt.h + pure-transform.h + rdf.h + remove-last.h + removeoverlap.h + require-config.h + resource-manager.h + round-test.h + round.h + rubberband.h + satisfied-guide-cns.h + selcue.h + selection-chemistry.h + selection-describer.h + selection.h + seltrans-handles.h + seltrans.h + shortcuts.h + snap-candidate.h + snap-enums.h + snap-preferences.h + snap.h + snapped-curve.h + snapped-line.h + snapped-point.h + snapper.h + splivarot.h + streq.h + strneq.h + style-enums.h + style-internal.h + style-test.h + style.h + svg-profile.h + svg-view-widget.h + svg-view.h + syseq.h + test-helpers.h + text-chemistry.h + text-editing.h + text-tag-attributes.h + transf_mat_3x4.h + unclump.h + undo-stack-observer.h + unicoderange.h + uri-references.h + uri-test.h + uri.h + vanishing-point.h + verbs-test.h + verbs.h + version.h ) # ----------------------------------------------------------------------------- @@ -425,19 +425,19 @@ set(inkscape_SRC # a custom target that is always built add_custom_target( - inkscape_version ALL - COMMAND ${CMAKE_COMMAND} - -DINKSCAPE_SOURCE_DIR=${CMAKE_SOURCE_DIR} - -DINKSCAPE_BINARY_DIR=${CMAKE_BINARY_DIR} - -P ${CMAKE_SOURCE_DIR}/CMakeScripts/inkscape-version.cmake) + inkscape_version ALL + COMMAND ${CMAKE_COMMAND} + -DINKSCAPE_SOURCE_DIR=${CMAKE_SOURCE_DIR} + -DINKSCAPE_BINARY_DIR=${CMAKE_BINARY_DIR} + -P ${CMAKE_SOURCE_DIR}/CMakeScripts/inkscape-version.cmake) # buildinfo.h is a generated file set_source_files_properties( - ${CMAKE_BINARY_DIR}/src/inkscape-version.cpp - PROPERTIES GENERATED TRUE) + ${CMAKE_BINARY_DIR}/src/inkscape-version.cpp + PROPERTIES GENERATED TRUE) list(APPEND inkscape_SRC - ${CMAKE_BINARY_DIR}/src/inkscape-version.cpp + ${CMAKE_BINARY_DIR}/src/inkscape-version.cpp ) @@ -477,8 +477,8 @@ add_subdirectory(libdepixelize) get_property(inkscape_global_SRC GLOBAL PROPERTY inkscape_global_SRC) set(inkscape_SRC - ${inkscape_global_SRC} - ${inkscape_SRC} + ${inkscape_global_SRC} + ${inkscape_SRC} ) # ----------------------------------------------------------------------------- @@ -488,23 +488,23 @@ set(inkscape_SRC #add_inkscape_lib(inkscape_LIB "${inkscape_SRC}") if(WIN32) - # Sources for the inkscape executable on Windows. - set(main_SRC - registrytool.h - registrytool.cpp - main.cpp - winmain.cpp - #winconsole.cpp - ) - - # Add the platform specific resource files (enabling the app icon). - if(${HAVE_MINGW64}) - list(APPEND main_SRC inkscape-x64.rc) - else() - list(APPEND main_SRC inkscape.rc) - endif() + # Sources for the inkscape executable on Windows. + set(main_SRC + registrytool.h + registrytool.cpp + main.cpp + winmain.cpp + #winconsole.cpp + ) + + # Add the platform specific resource files (enabling the app icon). + if(${HAVE_MINGW64}) + list(APPEND main_SRC inkscape-x64.rc) + else() + list(APPEND main_SRC inkscape.rc) + endif() else() - set(main_SRC main.cpp) + set(main_SRC main.cpp) endif() # Build everything except main and inkview.c in a shared library. @@ -550,4 +550,15 @@ target_link_libraries(inkscape_base ${INKSCAPE_TARGET_LIBS}) # Link inkscape and inkview against inkscape_base target_link_libraries(inkscape inkscape_base) -target_link_libraries(inkview inkscape_base) \ No newline at end of file +target_link_libraries(inkview inkscape_base) + +if(NOT WIN32) + #Define the installation + install(TARGETS + inkscape_base + inkscape + inkview + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib/inkscape + ARCHIVE DESTINATION lib/inkscape) +endif() -- cgit v1.2.3 From 71cb7d8ddbabf102501c9b245c2eea99a4ba1011 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Fri, 8 Jul 2016 09:17:55 +0200 Subject: Documentation. French documentation translation updated. (bzr r15013) --- src/ui/dialog/aboutbox.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp index 1a87a9718..6276d3391 100644 --- a/src/ui/dialog/aboutbox.cpp +++ b/src/ui/dialog/aboutbox.cpp @@ -467,7 +467,8 @@ void AboutBox::initStrings() { "Adib Taraben , 2004-2014.\n" "Alan Monfort , 2009-2010.\n" "Alastair McKinstry , 2000.\n" -"Aleksandar Urošević , 2004-2006.\n" +"Aleksandar Marković , 2015.\n" +"Aleksandar Urošević , 2004-2009.\n" "Alessio Frusciante , 2002, 2003.\n" "Alexander Shopov , 2006.\n" "Alexandre Prokoudine , 2005, 2010-2014.\n" @@ -499,18 +500,19 @@ void AboutBox::initStrings() { "Cédric Gemy , 2006.\n" "Daniel Díaz , 2004.\n" "Didier Conchaudron , 2003.\n" -"Dimitris Spingos , 2011-2013.\n" +"Dimitris Spingos (Δημήτρης Σπίγγος) , 2011-2015.\n" "Dorji Tashi , 2006.\n" "Duarte Loreto 2002, 2003 (Maintainer).\n" "Elias Norberg , 2009.\n" "Equipe de Tradução Inkscape Brasil , 2007.\n" "Fatih Demir , 2000.\n" -"Firas Hanife , 2014-2015.\n" +"Firas Hanife , 2014-2016.\n" "Foppe Benedictus , 2007-2009.\n" "Francesc Dorca , 2003. Traducció sodipodi.\n" "Francisco Javier F. Serrador , 2003.\n" "Francisco Xosé Vázquez Grandal , 2001.\n" "Frederic Rodrigo , 2004-2005.\n" +"Ganesh Murmu , 2014.\n" "Ge'ez Frontier Foundation , 2002.\n" "George Boukeas , 2011.\n" "Heiko Wöhrle , 2014.\n" @@ -528,6 +530,7 @@ void AboutBox::initStrings() { "Jeroen van der Vegt , 2003, 2005, 2008.\n" "Jin-Hwan Jeong , 2009.\n" "Jonathan Ernst , 2006.\n" +"Jordi Mas i Hernàndez , 2015.\n" "Jose Antonio Salgueiro Aquino , 2003.\n" "Josef Vybiral , 2005-2006.\n" "Juarez Rudsatz , 2004.\n" @@ -542,10 +545,11 @@ void AboutBox::initStrings() { "Kingsley Turner , 2006.\n" "Kitae , 2006.\n" "Kjartan Maraas , 2000-2002.\n" -"Kris De Gussem , 2008-2014.\n" +"Kris De Gussem , 2008-2015.\n" "Lauris Kaplinski , 2000.\n" "Leandro Regueiro , 2006-2008, 2010.\n" "Liu Xiaoqin , 2008.\n" +"Louni Kandulna , 2014.\n" "Luca Bruno , 2005.\n" "Lucas Vieites Fariña, 2003-2013.\n" "Mahesh subedi , 2006.\n" @@ -561,8 +565,10 @@ void AboutBox::initStrings() { "Mufit Eribol , 2000.\n" "Muhammad Bashir Al-Noimi , 2008.\n" "Myckel Habets , 2008.\n" +"Nasreen , 2013.\n" "Nguyen Dinh Trung , 2007, 2008.\n" -"Nicolas Dufour , 2008-2014.\n" +"Nicolas Dufour , 2008-2016.\n" +"Paresh prabhu , 2013.\n" "Pawan Chitrakar , 2006.\n" "Przemysław Loesch , 2005.\n" "Quico Llach , 2000. Traducció sodipodi.\n" @@ -570,6 +576,8 @@ void AboutBox::initStrings() { "Riku Leino , 2006-2011.\n" "Rune Rønde Laursen , 2006.\n" "Ruud Steltenpool , 2006.\n" +"Sangeeta , 2011.\n" +"Savitha , 2013.\n" "Serdar Soytetir , 2005.\n" "shivaken , 2004.\n" "Shyam Krishna Bal , 2006.\n" @@ -577,8 +585,11 @@ void AboutBox::initStrings() { "Spyros Blanas , 2006, 2011.\n" "Stefan Graubner , 2005.\n" "Supranee Thirawatthanasuk , 2006.\n" +"Sushma Joshi , 2011.\n" +"Sveinn í Felli , 2014-2015.\n" +"Sylvain Chiron , 2016.\n" "Takeshi Aihana , 2000, 2001.\n" -"Tim Sheridan , 2007-2014.\n" +"Tim Sheridan , 2007-2016.\n" "Theppitak Karoonboonyanan , 2006.\n" "Thiago Pimentel , 2006.\n" "Toshifumi Sato , 2005.\n" @@ -592,6 +603,7 @@ void AboutBox::initStrings() { "Vital Khilko , 2003.\n" "Vitaly Lipatov , 2002, 2004.\n" "vonHalenbach , 2005.\n" +"vrundeshw , 2012.\n" "Waluyo Adi Siswanto , 2011.\n" "Wang Li , 2002.\n" "Wei-Lun Chao , 2006.\n" -- cgit v1.2.3 From 1ba616c66fa080af9f6afc94af4e16247ed2dada Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sun, 10 Jul 2016 18:38:29 +0200 Subject: Comment out unused enum. (bzr r15015) --- src/xml/event.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/xml/event.h b/src/xml/event.h index 73e68daeb..f6b734c29 100644 --- a/src/xml/event.h +++ b/src/xml/event.h @@ -33,13 +33,13 @@ namespace XML { /** * @brief Enumeration of all XML event types */ -enum EventType { - EVENT_ADD, ///< Child added - EVENT_DEL, ///< Child removed - EVENT_CHG_ATTR, ///< Attribute changed - EVENT_CHG_CONTENT, ///< Content changed - EVENT_CHG_ORDER ///< Order of children changed -}; +// enum EventType { +// EVENT_ADD, ///< Child added +// EVENT_DEL, ///< Child removed +// EVENT_CHG_ATTR, ///< Attribute changed +// EVENT_CHG_CONTENT, ///< Content changed +// EVENT_CHG_ORDER ///< Order of children changed +// }; /** * @brief Generic XML modification event -- cgit v1.2.3 From a42c66cd5a915c7ddba323af7ec714d629e6059b Mon Sep 17 00:00:00 2001 From: Alex Henrie Date: Mon, 18 Jul 2016 11:19:25 -0600 Subject: [Bug #1524838] Disambiguate sigc::ptr_fun to fix C++14 compilation. (bzr r15016.1.1) --- src/ui/dialog/knot-properties.cpp | 2 +- src/ui/dialog/layer-properties.cpp | 2 +- src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 2 +- src/ui/dialog/lpe-powerstroke-properties.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/knot-properties.cpp b/src/ui/dialog/knot-properties.cpp index 9c23c33e1..a91a09a4f 100644 --- a/src/ui/dialog/knot-properties.cpp +++ b/src/ui/dialog/knot-properties.cpp @@ -145,7 +145,7 @@ KnotPropertiesDialog::_close() destroy_(); Glib::signal_idle().connect( sigc::bind_return( - sigc::bind(sigc::ptr_fun(&::operator delete), this), + sigc::bind(sigc::ptr_fun(&::operator delete), this), false ) ); diff --git a/src/ui/dialog/layer-properties.cpp b/src/ui/dialog/layer-properties.cpp index 1b8fbb3f7..5d550ed48 100644 --- a/src/ui/dialog/layer-properties.cpp +++ b/src/ui/dialog/layer-properties.cpp @@ -146,7 +146,7 @@ LayerPropertiesDialog::_close() destroy_(); Glib::signal_idle().connect( sigc::bind_return( - sigc::bind(sigc::ptr_fun(&::operator delete), this), + sigc::bind(sigc::ptr_fun(&::operator delete), this), false ) ); diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index 5ccee103c..b0cc91868 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -177,7 +177,7 @@ void FilletChamferPropertiesDialog::_close() destroy_(); Glib::signal_idle().connect( sigc::bind_return( - sigc::bind(sigc::ptr_fun(&::operator delete), this), + sigc::bind(sigc::ptr_fun(&::operator delete), this), false ) ); diff --git a/src/ui/dialog/lpe-powerstroke-properties.cpp b/src/ui/dialog/lpe-powerstroke-properties.cpp index cfc972547..a6dcce907 100644 --- a/src/ui/dialog/lpe-powerstroke-properties.cpp +++ b/src/ui/dialog/lpe-powerstroke-properties.cpp @@ -146,7 +146,7 @@ PowerstrokePropertiesDialog::_close() destroy_(); Glib::signal_idle().connect( sigc::bind_return( - sigc::bind(sigc::ptr_fun(&::operator delete), this), + sigc::bind(sigc::ptr_fun(&::operator delete), this), false ) ); -- cgit v1.2.3 From a83543fbf553fb141ec68386ecc77e2bffe36b10 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Fri, 22 Jul 2016 17:22:19 +0200 Subject: Fixed null when selection contains more than one item Fixed bugs: - https://launchpad.net/bugs/1591390 (bzr r15018) --- src/ui/tools/tool-base.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index 36fe26e76..72ba499de 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -1083,7 +1083,7 @@ void sp_event_root_menu_popup(SPDesktop *desktop, SPItem *item, GdkEvent *event) /* fixme: This is not what I want but works for now (Lauris) */ if (event->type == GDK_KEY_PRESS) { - item = desktop->getSelection()->singleItem(); + item = desktop->getSelection()->itemList().front(); } ContextMenu* CM = new ContextMenu(desktop, item); -- cgit v1.2.3 From 1dd869116719a20f503e05f3b01cddb8b0c97ed6 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Sat, 23 Jul 2016 11:30:20 +0200 Subject: Fix auto palette when using extensions (bzr r15019) --- src/document-undo.cpp | 7 ++++++- src/document.cpp | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/document-undo.cpp b/src/document-undo.cpp index eb0ac7707..c27904ea8 100644 --- a/src/document-undo.cpp +++ b/src/document-undo.cpp @@ -196,6 +196,7 @@ void Inkscape::DocumentUndo::cancel(SPDocument *doc) if (doc->priv->partial) { sp_repr_undo_log (doc->priv->partial); + doc->emitReconstructionFinish(); sp_repr_free_log (doc->priv->partial); doc->priv->partial = NULL; } @@ -222,6 +223,8 @@ static void perform_document_update(SPDocument &doc) { doc.ensureUpToDate(); Inkscape::XML::Event *update_log=sp_repr_commit_undoable(doc.rdoc); + doc.emitReconstructionFinish(); + if (update_log != NULL) { g_warning("Document was modified while being updated after undo operation"); sp_repr_debug_print_log(update_log); @@ -322,8 +325,10 @@ gboolean Inkscape::DocumentUndo::redo(SPDocument *doc) doc->priv->sensitive = TRUE; doc->priv->seeking = false; - if (ret) + if (ret) { INKSCAPE.external_change(); + doc->emitReconstructionFinish(); + } return ret; } diff --git a/src/document.cpp b/src/document.cpp index 902dabbc3..9f408788b 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -955,6 +955,9 @@ SPDocument::emitReconstructionFinish(void) { // printf("Finishing Reconstruction\n"); priv->_reconstruction_finish_signal.emit(); + // indicates that gradients are reloaded (to rebuild the Auto palette) + priv->resources_changed_signals[g_quark_from_string("gradient")].emit(); + /** // Reference to the old persp3d object is invalid after reconstruction. -- cgit v1.2.3 From 98d87665f4230cbd85df6b6c7d61be770ac6524a Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 23 Jul 2016 20:53:24 +0200 Subject: Order and cleanup of some LPE (bzr r15020) --- src/live_effects/lpe-copy_rotate.cpp | 3 ++- src/live_effects/lpe-lattice2.cpp | 7 +++---- src/live_effects/lpe-lattice2.h | 2 +- src/live_effects/lpe-mirror_symmetry.cpp | 5 ++--- src/live_effects/lpe-mirror_symmetry.h | 2 +- src/live_effects/lpe-roughen.cpp | 6 +++--- src/live_effects/lpe-roughen.h | 1 + src/live_effects/lpe-show_handles.cpp | 4 ++-- src/live_effects/lpe-show_handles.h | 2 +- src/live_effects/lpe-simplify.cpp | 5 ++--- src/live_effects/lpe-simplify.h | 2 +- 11 files changed, 19 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/live_effects/lpe-copy_rotate.cpp b/src/live_effects/lpe-copy_rotate.cpp index efea76039..80f5bdafd 100644 --- a/src/live_effects/lpe-copy_rotate.cpp +++ b/src/live_effects/lpe-copy_rotate.cpp @@ -11,7 +11,6 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include #include #include <2geom/path-intersection.h> #include <2geom/sbasis-to-bezier.h> @@ -22,6 +21,8 @@ #include "knot-holder-entity.h" #include "knotholder.h" +// TODO due to internal breakage in glibmm headers, this must be last: +#include namespace Inkscape { namespace LivePathEffect { diff --git a/src/live_effects/lpe-lattice2.cpp b/src/live_effects/lpe-lattice2.cpp index 0c403daec..bacbe5fa7 100644 --- a/src/live_effects/lpe-lattice2.cpp +++ b/src/live_effects/lpe-lattice2.cpp @@ -17,9 +17,6 @@ */ #include "live_effects/lpe-lattice2.h" - -#include - #include "sp-shape.h" #include "sp-item.h" #include "sp-path.h" @@ -36,6 +33,8 @@ #include <2geom/d2.h> #include <2geom/piecewise.h> #include <2geom/transforms.h> +// TODO due to internal breakage in glibmm headers, this must be last: +#include using namespace Geom; @@ -280,7 +279,7 @@ void LPELattice2::onExpanderChanged() { expanded = expander->get_expanded(); - if(expander->get_expanded()) { + if(expanded) { expander->set_label (Glib::ustring(_("Hide Points"))); } else { expander->set_label (Glib::ustring(_("Show Points"))); diff --git a/src/live_effects/lpe-lattice2.h b/src/live_effects/lpe-lattice2.h index 8d0c18a3a..07bc4af86 100644 --- a/src/live_effects/lpe-lattice2.h +++ b/src/live_effects/lpe-lattice2.h @@ -18,8 +18,8 @@ * * Released under GNU GPL, read the file 'COPYING' for more information */ +#include #include "live_effects/parameter/enum.h" -#include #include "live_effects/effect.h" #include "live_effects/parameter/point.h" #include "live_effects/lpegroupbbox.h" diff --git a/src/live_effects/lpe-mirror_symmetry.cpp b/src/live_effects/lpe-mirror_symmetry.cpp index 9f3070ff4..cf866ad6a 100644 --- a/src/live_effects/lpe-mirror_symmetry.cpp +++ b/src/live_effects/lpe-mirror_symmetry.cpp @@ -13,9 +13,6 @@ * * Released under GNU GPL, read the file 'COPYING' for more information */ -#include -#include - #include "live_effects/lpe-mirror_symmetry.h" #include #include @@ -28,6 +25,8 @@ #include "knot-holder-entity.h" #include "knotholder.h" #include "inkscape.h" +// TODO due to internal breakage in glibmm headers, this must be last: +#include namespace Inkscape { namespace LivePathEffect { diff --git a/src/live_effects/lpe-mirror_symmetry.h b/src/live_effects/lpe-mirror_symmetry.h index 3a244cb7e..9e5b4d628 100644 --- a/src/live_effects/lpe-mirror_symmetry.h +++ b/src/live_effects/lpe-mirror_symmetry.h @@ -15,7 +15,7 @@ * * Released under GNU GPL, read the file 'COPYING' for more information */ - +#include #include "live_effects/effect.h" #include "live_effects/parameter/parameter.h" #include "live_effects/parameter/point.h" diff --git a/src/live_effects/lpe-roughen.cpp b/src/live_effects/lpe-roughen.cpp index 105fe2fc4..14137b043 100644 --- a/src/live_effects/lpe-roughen.cpp +++ b/src/live_effects/lpe-roughen.cpp @@ -13,16 +13,16 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include -#include "desktop.h" #include "live_effects/lpe-roughen.h" +#include "desktop.h" #include "display/curve.h" #include "live_effects/parameter/parameter.h" #include #include "helper/geom.h" #include "sp-item-group.h" -#include #include +// TODO due to internal breakage in glibmm headers, this must be last: +#include namespace Inkscape { namespace LivePathEffect { diff --git a/src/live_effects/lpe-roughen.h b/src/live_effects/lpe-roughen.h index 44a723c89..c4be8fed7 100644 --- a/src/live_effects/lpe-roughen.h +++ b/src/live_effects/lpe-roughen.h @@ -12,6 +12,7 @@ #ifndef INKSCAPE_LPE_ROUGHEN_H #define INKSCAPE_LPE_ROUGHEN_H +#include #include "live_effects/parameter/enum.h" #include "live_effects/effect.h" #include "live_effects/parameter/parameter.h" diff --git a/src/live_effects/lpe-show_handles.cpp b/src/live_effects/lpe-show_handles.cpp index 0bc1c4f17..2d4666fe4 100644 --- a/src/live_effects/lpe-show_handles.cpp +++ b/src/live_effects/lpe-show_handles.cpp @@ -6,8 +6,6 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include -#include #include "live_effects/lpe-show_handles.h" #include "live_effects/parameter/parameter.h" #include <2geom/sbasis-to-bezier.h> @@ -16,6 +14,8 @@ #include "desktop-style.h" #include "style.h" #include "svg/svg.h" +// TODO due to internal breakage in glibmm headers, this must be last: +#include namespace Inkscape { namespace LivePathEffect { diff --git a/src/live_effects/lpe-show_handles.h b/src/live_effects/lpe-show_handles.h index 34390dd32..8bff3c1a8 100644 --- a/src/live_effects/lpe-show_handles.h +++ b/src/live_effects/lpe-show_handles.h @@ -8,7 +8,7 @@ * Copyright (C) Jabier Arraiza Cenoz 2014 * Released under GNU GPL, read the file 'COPYING' for more information */ - +#include #include "live_effects/effect.h" #include "live_effects/lpegroupbbox.h" #include "live_effects/parameter/bool.h" diff --git a/src/live_effects/lpe-simplify.cpp b/src/live_effects/lpe-simplify.cpp index f807bdc8d..b0c1fbc23 100644 --- a/src/live_effects/lpe-simplify.cpp +++ b/src/live_effects/lpe-simplify.cpp @@ -2,12 +2,9 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include - #include "live_effects/lpe-simplify.h" #include "display/curve.h" #include "live_effects/parameter/parameter.h" -#include #include "helper/geom.h" #include "livarot/Path.h" #include "splivarot.h" @@ -21,6 +18,8 @@ #include <2geom/interval.h> #include "ui/icon-names.h" #include "util/units.h" +// TODO due to internal breakage in glibmm headers, this must be last: +#include namespace Inkscape { namespace LivePathEffect { diff --git a/src/live_effects/lpe-simplify.h b/src/live_effects/lpe-simplify.h index 294d77b35..8135561af 100644 --- a/src/live_effects/lpe-simplify.h +++ b/src/live_effects/lpe-simplify.h @@ -6,7 +6,7 @@ * * Released under GNU GPL, read the file 'COPYING' for more information */ - +#include #include "live_effects/effect.h" #include "live_effects/parameter/togglebutton.h" #include "live_effects/lpegroupbbox.h" -- cgit v1.2.3 From 06caba8f2caeb07011e492d7218f0b8f6b28e801 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 24 Jul 2016 17:05:29 +0200 Subject: Fises to toggle button and coding style (bzr r15021) --- src/live_effects/parameter/togglebutton.cpp | 70 +++++++++++++++-------------- src/live_effects/parameter/togglebutton.h | 8 ++-- src/ui/widget/registered-widget.cpp | 6 +-- src/ui/widget/registered-widget.h | 3 +- 4 files changed, 44 insertions(+), 43 deletions(-) (limited to 'src') diff --git a/src/live_effects/parameter/togglebutton.cpp b/src/live_effects/parameter/togglebutton.cpp index 47a8b5615..c761731b7 100644 --- a/src/live_effects/parameter/togglebutton.cpp +++ b/src/live_effects/parameter/togglebutton.cpp @@ -24,10 +24,10 @@ namespace LivePathEffect { ToggleButtonParam::ToggleButtonParam( const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Inkscape::UI::Widget::Registry* wr, Effect* effect, bool default_value, const Glib::ustring& inactive_label, - char const * icon_active, char const * icon_inactive, - Inkscape::IconSize icon_size) + char const * _icon_active, char const * _icon_inactive, + Inkscape::IconSize _icon_size) : Parameter(label, tip, key, wr, effect), value(default_value), defvalue(default_value), - inactiveLabel(inactive_label), iconActive(icon_active), iconInactive(icon_inactive), iconSize(icon_size) + inactive_label(inactive_label), _icon_active(_icon_active), _icon_inactive(_icon_inactive), _icon_size(_icon_size) { checkwdg = NULL; } @@ -75,38 +75,40 @@ ToggleButtonParam::param_newWidget() param_effect->getRepr(), param_effect->getSPDoc()) ); #if GTK_CHECK_VERSION(3,0,0) - GtkWidget * boxButton = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_box_set_homogeneous(GTK_BOX(boxButton), false); + GtkWidget * box_button = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); + gtk_box_set_homogeneous(GTK_BOX(box_button), false); #else - GtkWidget * boxButton = gtk_hbox_new (false, 0); + GtkWidget * box_button = gtk_hbox_new (false, 0); #endif - GtkWidget * labelButton = gtk_label_new (""); + GtkWidget * label_button = gtk_label_new (""); if (!param_label.empty()) { - if(value || inactiveLabel.empty()){ - gtk_label_set_text(GTK_LABEL(labelButton), param_label.c_str()); + if(value || inactive_label.empty()){ + gtk_label_set_text(GTK_LABEL(label_button), param_label.c_str()); }else{ - gtk_label_set_text(GTK_LABEL(labelButton), inactiveLabel.c_str()); + gtk_label_set_text(GTK_LABEL(label_button), inactive_label.c_str()); } } - gtk_widget_show(labelButton); - if ( iconActive ) { - if(!iconInactive){ - iconInactive = iconActive; + gtk_widget_show(label_button); + if ( _icon_active ) { + if(!_icon_inactive){ + _icon_inactive = _icon_active; } - gtk_widget_show(boxButton); - GtkWidget *iconButton = sp_icon_new(iconSize, iconActive); + gtk_widget_show(box_button); + GtkWidget *icon_button = NULL; if(!value){ - iconButton = sp_icon_new(iconSize, iconInactive); + icon_button = sp_icon_new(_icon_size, _icon_inactive); + } else { + icon_button = sp_icon_new(_icon_size, _icon_active); } - gtk_widget_show(iconButton); - gtk_box_pack_start (GTK_BOX(boxButton), iconButton, false, false, 1); + gtk_widget_show(icon_button); + gtk_box_pack_start (GTK_BOX(box_button), icon_button, false, false, 1); if (!param_label.empty()) { - gtk_box_pack_start (GTK_BOX(boxButton), labelButton, false, false, 1); + gtk_box_pack_start (GTK_BOX(box_button), label_button, false, false, 1); } }else{ - gtk_box_pack_start (GTK_BOX(boxButton), labelButton, false, false, 1); + gtk_box_pack_start (GTK_BOX(box_button), label_button, false, false, 1); } - checkwdg->add(*Gtk::manage(Glib::wrap(boxButton))); + checkwdg->add(*Gtk::manage(Glib::wrap(box_button))); checkwdg->setActive(value); checkwdg->setProgrammatically = false; checkwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change togglebutton parameter")); @@ -126,25 +128,27 @@ ToggleButtonParam::refresh_button() if(!checkwdg){ return; } - Gtk::Widget * boxButton = checkwdg->get_child(); - if(!boxButton){ + Gtk::Widget * box_button = checkwdg->get_child(); + if(!box_button){ return; } - GList * childs = gtk_container_get_children(GTK_CONTAINER(boxButton->gobj())); - guint totalWidgets = g_list_length (childs); + GList * childs = gtk_container_get_children(GTK_CONTAINER(box_button->gobj())); + guint total_widgets = g_list_length (childs); if (!param_label.empty()) { - if(value || inactiveLabel.empty()){ - gtk_label_set_text(GTK_LABEL(g_list_nth_data(childs, totalWidgets-1)), param_label.c_str()); + if(value || inactive_label.empty()){ + gtk_label_set_text(GTK_LABEL(g_list_nth_data(childs, total_widgets-1)), param_label.c_str()); }else{ - gtk_label_set_text(GTK_LABEL(g_list_nth_data(childs, totalWidgets-1)), inactiveLabel.c_str()); + gtk_label_set_text(GTK_LABEL(g_list_nth_data(childs, total_widgets-1)), inactive_label.c_str()); } } - if ( iconActive ) { - GdkPixbuf * iconPixbuf = sp_pixbuf_new( iconSize, iconActive ); + if ( _icon_active ) { + GdkPixbuf * icon_pixbuf = NULL; if(!value){ - iconPixbuf = sp_pixbuf_new( iconSize, iconInactive); + icon_pixbuf = sp_pixbuf_new( _icon_size, _icon_inactive ); + } else { + icon_pixbuf = sp_pixbuf_new( _icon_size, _icon_active ); } - gtk_image_set_from_pixbuf (GTK_IMAGE(g_list_nth_data(childs, 0)), iconPixbuf); + gtk_image_set_from_pixbuf (GTK_IMAGE(g_list_nth_data(childs, 0)), icon_pixbuf); } } diff --git a/src/live_effects/parameter/togglebutton.h b/src/live_effects/parameter/togglebutton.h index 4e545bcfd..8390fec86 100644 --- a/src/live_effects/parameter/togglebutton.h +++ b/src/live_effects/parameter/togglebutton.h @@ -59,10 +59,10 @@ private: void refresh_button(); bool value; bool defvalue; - const Glib::ustring inactiveLabel; - const char * iconActive; - const char * iconInactive; - Inkscape::IconSize iconSize; + const Glib::ustring inactive_label; + const char * _icon_active; + const char * _icon_inactive; + Inkscape::IconSize _icon_size; Inkscape::UI::Widget::RegisteredToggleButton * checkwdg; sigc::signal _signal_toggled; diff --git a/src/ui/widget/registered-widget.cpp b/src/ui/widget/registered-widget.cpp index 298377af3..572845668 100644 --- a/src/ui/widget/registered-widget.cpp +++ b/src/ui/widget/registered-widget.cpp @@ -113,10 +113,8 @@ RegisteredToggleButton::~RegisteredToggleButton() _toggled_connection.disconnect(); } -RegisteredToggleButton::RegisteredToggleButton (const Glib::ustring& /*label*/, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right, Inkscape::XML::Node* repr_in, SPDocument *doc_in, char const *active_str, char const *inactive_str) +RegisteredToggleButton::RegisteredToggleButton (const Glib::ustring& /*label*/, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right, Inkscape::XML::Node* repr_in, SPDocument *doc_in, char const *icon_active, char const *icon_inactive) : RegisteredWidget() - , _active_str(active_str) - , _inactive_str(inactive_str) { init_parent(key, wr, repr_in, doc_in); setProgrammatically = false; @@ -149,7 +147,7 @@ RegisteredToggleButton::on_toggled() return; _wr->setUpdating (true); - write_to_xml(get_active() ? _active_str : _inactive_str); + write_to_xml(get_active() ? "true" : "false"); //The slave button is greyed out if the master button is untoggled for (std::list::const_iterator i = _slavewidgets.begin(); i != _slavewidgets.end(); ++i) { (*i)->set_sensitive(get_active()); diff --git a/src/ui/widget/registered-widget.h b/src/ui/widget/registered-widget.h index 9d2489712..ab2e4c8e4 100644 --- a/src/ui/widget/registered-widget.h +++ b/src/ui/widget/registered-widget.h @@ -166,7 +166,7 @@ protected: class RegisteredToggleButton : public RegisteredWidget { public: virtual ~RegisteredToggleButton(); - RegisteredToggleButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right=true, Inkscape::XML::Node* repr_in=NULL, SPDocument *doc_in=NULL, char const *active_str = "true", char const *inactive_str = "false"); + RegisteredToggleButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right=true, Inkscape::XML::Node* repr_in=NULL, SPDocument *doc_in=NULL, char const *icon_active = "true", char const *icon_inactive = "false"); void setActive (bool); @@ -183,7 +183,6 @@ public: // if a callback checks it, it must reset it back to false protected: - char const *_active_str, *_inactive_str; sigc::connection _toggled_connection; void on_toggled(); }; -- cgit v1.2.3 From 325f658295ffa45c23c681a6a96a76acf232ef29 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 24 Jul 2016 17:58:34 +0200 Subject: Fixed a bug on roughen LPE on open paths (bzr r15022) --- src/live_effects/lpe-roughen.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src') diff --git a/src/live_effects/lpe-roughen.cpp b/src/live_effects/lpe-roughen.cpp index 14137b043..13f2b7b51 100644 --- a/src/live_effects/lpe-roughen.cpp +++ b/src/live_effects/lpe-roughen.cpp @@ -229,7 +229,7 @@ void LPERoughen::doEffect(SPCurve *curve) nCurve->lineto(curve_it1->finalPoint()); } last_move = Geom::Point(0, 0); - double length = curve_it1->length(0.001); + double length = curve_it1->length(0.01); std::size_t splits = 0; if (method == DM_SEGMENTS) { splits = segments; @@ -354,9 +354,6 @@ SPCurve const * LPERoughen::addNodesAndJitter(Geom::Curve const * A, Geom::Point point_a3 = seg1[3] + point_a3; ray.setPoints(prev,A->initialPoint()); point_a1 = A->initialPoint() + Geom::Point::polar(ray.angle(), max_lenght); - if(prev == Geom::Point(0,0)){ - point_a1 = randomize(max_lenght); - } if(last){ Geom::Path b2(point_b3); b2.appendNew(point_a3); -- cgit v1.2.3 From c6c1a5740f4778826030b6b724063d757a7cc603 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 24 Jul 2016 19:27:32 +0200 Subject: Order some headers (bzr r15023) --- src/live_effects/lpe-lattice2.h | 2 +- src/live_effects/lpe-roughen.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/live_effects/lpe-lattice2.h b/src/live_effects/lpe-lattice2.h index 07bc4af86..4a025d182 100644 --- a/src/live_effects/lpe-lattice2.h +++ b/src/live_effects/lpe-lattice2.h @@ -19,8 +19,8 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ #include -#include "live_effects/parameter/enum.h" #include "live_effects/effect.h" +#include "live_effects/parameter/enum.h" #include "live_effects/parameter/point.h" #include "live_effects/lpegroupbbox.h" diff --git a/src/live_effects/lpe-roughen.h b/src/live_effects/lpe-roughen.h index c4be8fed7..dbdb91e62 100644 --- a/src/live_effects/lpe-roughen.h +++ b/src/live_effects/lpe-roughen.h @@ -13,8 +13,8 @@ #define INKSCAPE_LPE_ROUGHEN_H #include -#include "live_effects/parameter/enum.h" #include "live_effects/effect.h" +#include "live_effects/parameter/enum.h" #include "live_effects/parameter/parameter.h" #include "live_effects/parameter/path.h" #include "live_effects/parameter/bool.h" -- cgit v1.2.3 From 40136abc93171fd163a78472cdeaf5d875acefda Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Sun, 24 Jul 2016 22:27:21 -0700 Subject: Revert the canvas widget changes, which cause performance regressions on GTK2 on some platforms. (bzr r15023.3.1) --- src/desktop.cpp | 19 ++- src/desktop.h | 1 + src/display/sp-canvas.cpp | 376 ++++++++++++++++++++++++---------------------- src/display/sp-canvas.h | 33 ++-- 4 files changed, 229 insertions(+), 200 deletions(-) (limited to 'src') diff --git a/src/desktop.cpp b/src/desktop.cpp index d482d0d7f..331ab3351 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -111,6 +111,7 @@ SPDesktop::SPDesktop() : sketch( NULL ), controls( NULL ), tempgroup ( NULL ), + table( NULL ), page( NULL ), page_border( NULL ), current( NULL ), @@ -210,7 +211,11 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas, Inkscape::UI::View::EditWid g_signal_connect (G_OBJECT (main), "event", G_CALLBACK (sp_desktop_root_handler), this); /* This is the background the page sits on. */ - canvas->setBackgroundColor(0xffffff00); + table = sp_canvas_item_new (main, SP_TYPE_CTRLRECT, NULL); + SP_CTRLRECT(table)->setRectangle(Geom::Rect(Geom::Point(-80000, -80000), Geom::Point(80000, 80000))); + SP_CTRLRECT(table)->setColor(0x00000000, true, 0x00000000); + SP_CTRLRECT(table)->setCheckerboard( false ); + sp_canvas_item_move_to_z (table, 0); page = sp_canvas_item_new (main, SP_TYPE_CTRLRECT, NULL); ((CtrlRect *) page)->setColor(0x00000000, FALSE, 0x00000000); @@ -1728,11 +1733,17 @@ static void _namedview_modified (SPObject *obj, guint flags, SPDesktop *desktop) SPNamedView *nv=SP_NAMEDVIEW(obj); if (flags & SP_OBJECT_MODIFIED_FLAG) { + + /* Set page background */ + sp_canvas_item_show (desktop->table); if (nv->pagecheckerboard) { - desktop->canvas->setBackgroundCheckerboard(); + ((CtrlRect *) desktop->table)->setCheckerboard( true ); + ((CtrlRect *) desktop->table)->setColor(0x00000000, true, nv->pagecolor ); // | 0xff); } else { - desktop->canvas->setBackgroundColor(nv->pagecolor); + ((CtrlRect *) desktop->table)->setCheckerboard( false ); + ((CtrlRect *) desktop->table)->setColor(0x00000000, true, nv->pagecolor | 0xff); } + sp_canvas_item_move_to_z (desktop->table, 0); /* Show/hide page border */ if (nv->showborder) { @@ -1745,7 +1756,7 @@ static void _namedview_modified (SPObject *obj, guint flags, SPDesktop *desktop) } // place in the z-order stack if (nv->borderlayer == SP_BORDER_LAYER_BOTTOM) { - sp_canvas_item_move_to_z (desktop->page_border, 1); + sp_canvas_item_move_to_z (desktop->page_border, 2); } else { int order = sp_canvas_item_order (desktop->page_border); int morder = sp_canvas_item_order (desktop->drawing); diff --git a/src/desktop.h b/src/desktop.h index 3652d4a97..f1444ba7b 100644 --- a/src/desktop.h +++ b/src/desktop.h @@ -174,6 +174,7 @@ public: SPCanvasGroup *sketch; SPCanvasGroup *controls; SPCanvasGroup *tempgroup; ///< contains temporary canvas items + SPCanvasItem *table; ///< outside-of-page background SPCanvasItem *page; ///< page background SPCanvasItem *page_border; ///< page border SPCSSAttr *current; ///< current style diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp index 7d76fa043..df84e379c 100644 --- a/src/display/sp-canvas.cpp +++ b/src/display/sp-canvas.cpp @@ -8,11 +8,9 @@ * fred * bbyak * Jon A. Cruz - * Krzysztof Kosiński * * Copyright (C) 1998 The Free Software Foundation * Copyright (C) 2002-2006 authors - * Copyright (C) 2016 Google Inc. * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -27,7 +25,6 @@ #include "helper/sp-marshal.h" #include <2geom/rect.h> #include <2geom/affine.h> -#include "display/cairo-utils.h" #include "display/sp-canvas.h" #include "display/sp-canvas-group.h" #include "preferences.h" @@ -38,7 +35,6 @@ #include "display/cairo-utils.h" #include "debug/gdk-event-latency-tracker.h" #include "desktop.h" -#include "color.h" using Inkscape::Debug::GdkEventLatencyTracker; @@ -126,7 +122,7 @@ struct SPCanvasClass { namespace { -gint const UPDATE_PRIORITY = G_PRIORITY_DEFAULT_IDLE; +gint const UPDATE_PRIORITY = G_PRIORITY_HIGH_IDLE; GdkWindow *getWindow(SPCanvas *canvas) { @@ -939,6 +935,7 @@ void sp_canvas_class_init(SPCanvasClass *klass) static void sp_canvas_init(SPCanvas *canvas) { gtk_widget_set_has_window (GTK_WIDGET (canvas), TRUE); + gtk_widget_set_double_buffered (GTK_WIDGET (canvas), FALSE); gtk_widget_set_can_focus (GTK_WIDGET (canvas), TRUE); canvas->_pick_event.type = GDK_LEAVE_NOTIFY; @@ -959,10 +956,9 @@ static void sp_canvas_init(SPCanvas *canvas) canvas->_drawing_disabled = false; - canvas->_backing_store = NULL; - canvas->_clean_region = cairo_region_create(); - canvas->_background = cairo_pattern_create_rgb(1, 1, 1); - canvas->_background_is_checkerboard = false; + canvas->_tiles=NULL; + canvas->_tLeft=canvas->_tTop=canvas->_tRight=canvas->_tBottom=0; + canvas->_tile_h=canvas->_tile_h=0; canvas->_forced_redraw_count = 0; canvas->_forced_redraw_limit = -1; @@ -971,12 +967,22 @@ static void sp_canvas_init(SPCanvas *canvas) canvas->_enable_cms_display_adj = false; new (&canvas->_cms_key) Glib::ustring(""); #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) + + canvas->_is_scrolling = false; } void SPCanvas::shutdownTransients() { - // Reset the clean region - dirtyAll(); + // We turn off the need_redraw flag, since if the canvas is mapped again + // it will request a redraw anyways. We do not turn off the need_update + // flag, though, because updates are not queued when the canvas remaps + // itself. + // + _need_redraw = FALSE; + if (_tiles) g_free(_tiles); + _tiles = NULL; + _tLeft = _tTop = _tRight = _tBottom = 0; + _tile_h = _tile_h = 0; if (_grabbed_item) { _grabbed_item = NULL; @@ -999,18 +1005,6 @@ void SPCanvas::dispose(GObject *object) g_object_unref (canvas->_root); canvas->_root = NULL; } - if (canvas->_backing_store) { - cairo_surface_destroy(canvas->_backing_store); - canvas->_backing_store = NULL; - } - if (canvas->_clean_region) { - cairo_region_destroy(canvas->_clean_region); - canvas->_clean_region = NULL; - } - if (canvas->_background) { - cairo_pattern_destroy(canvas->_background); - canvas->_background = NULL; - } canvas->shutdownTransients(); #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) @@ -1144,48 +1138,41 @@ void SPCanvas::handle_size_request(GtkWidget *widget, GtkRequisition *req) void SPCanvas::handle_size_allocate(GtkWidget *widget, GtkAllocation *allocation) { SPCanvas *canvas = SP_CANVAS (widget); - GtkAllocation old_allocation; + GtkAllocation widg_allocation; - gtk_widget_get_allocation(widget, &old_allocation); + gtk_widget_get_allocation (widget, &widg_allocation); -// Geom::IntRect old_area = Geom::IntRect::from_xywh(canvas->_x0, canvas->_y0, -// old_allocation.width, old_allocation.height); +// Geom::IntRect old_area = Geom::IntRect::from_xywh(canvas->x0, canvas->y0, +// widg_allocation.width, widg_allocation.height); Geom::IntRect new_area = Geom::IntRect::from_xywh(canvas->_x0, canvas->_y0, allocation->width, allocation->height); - // resize backing store - cairo_surface_t *new_backing_store = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, - allocation->width, allocation->height); - if (canvas->_backing_store) { - cairo_t *cr = cairo_create(new_backing_store); - cairo_translate(cr, -canvas->_x0, -canvas->_y0); - cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); - cairo_set_source(cr, canvas->_background); - cairo_paint(cr); - cairo_set_source_surface(cr, canvas->_backing_store, canvas->_x0, canvas->_y0); - cairo_paint(cr); - cairo_destroy(cr); - cairo_surface_destroy(canvas->_backing_store); - } - canvas->_backing_store = new_backing_store; - - // Clip the clean region to the new allocation - cairo_rectangle_int_t crect = { canvas->_x0, canvas->_y0, allocation->width, allocation->height }; - cairo_region_intersect_rectangle(canvas->_clean_region, &crect); - - gtk_widget_set_allocation (widget, allocation); - + // Schedule redraw of new region + canvas->resizeTiles(canvas->_x0, canvas->_y0, canvas->_x0 + allocation->width, canvas->_y0 + allocation->height); if (SP_CANVAS_ITEM_GET_CLASS (canvas->_root)->viewbox_changed) SP_CANVAS_ITEM_GET_CLASS (canvas->_root)->viewbox_changed (canvas->_root, new_area); + if (allocation->width > widg_allocation.width) { + canvas->requestRedraw(canvas->_x0 + widg_allocation.width, + 0, + canvas->_x0 + allocation->width, + canvas->_y0 + allocation->height); + } + if (allocation->height > widg_allocation.height) { + canvas->requestRedraw(0, + canvas->_y0 + widg_allocation.height, + canvas->_x0 + allocation->width, + canvas->_y0 + allocation->height); + } + + gtk_widget_set_allocation (widget, allocation); + if (gtk_widget_get_realized (widget)) { gdk_window_move_resize (gtk_widget_get_window (widget), allocation->x, allocation->y, allocation->width, allocation->height); } - // Schedule redraw of any newly exposed regions - canvas->addIdle(); } int SPCanvas::emitEvent(GdkEvent *event) @@ -1539,23 +1526,48 @@ int SPCanvas::handle_motion(GtkWidget *widget, GdkEventMotion *event) void SPCanvas::paintSingleBuffer(Geom::IntRect const &paint_rect, Geom::IntRect const &canvas_rect, int /*sw*/) { + GtkWidget *widget = GTK_WIDGET (this); + + // Mark the region clean + markRect(paint_rect, 0); + SPCanvasBuf buf; buf.buf = NULL; buf.buf_rowstride = 0; buf.rect = paint_rect; buf.visible_rect = canvas_rect; buf.is_empty = true; + //buf.ct = gdk_cairo_create(widget->window); // create temporary surface cairo_surface_t *imgs = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, paint_rect.width(), paint_rect.height()); buf.ct = cairo_create(imgs); + //cairo_translate(buf.ct, -x0, -y0); + + // fix coordinates, clip all drawing to the tile and clear the background + //cairo_translate(buf.ct, paint_rect.left() - canvas->x0, paint_rect.top() - canvas->y0); + //cairo_rectangle(buf.ct, 0, 0, paint_rect.width(), paint_rect.height()); + //cairo_set_line_width(buf.ct, 3); + //cairo_set_source_rgba(buf.ct, 1.0, 0.0, 0.0, 0.1); + //cairo_stroke_preserve(buf.ct); + //cairo_clip(buf.ct); + +#if GTK_CHECK_VERSION(3,0,0) + GtkStyleContext *context = gtk_widget_get_style_context(widget); + GdkRGBA color; + gtk_style_context_get_background_color(context, + gtk_widget_get_state_flags(widget), + &color); + gdk_cairo_set_source_rgba(buf.ct, &color); +#else + GtkStyle *style = gtk_widget_get_style (widget); + gdk_cairo_set_source_color(buf.ct, &style->bg[GTK_STATE_NORMAL]); +#endif - cairo_save(buf.ct); - cairo_translate(buf.ct, -paint_rect.left(), -paint_rect.top()); - cairo_set_source(buf.ct, _background); cairo_set_operator(buf.ct, CAIRO_OPERATOR_SOURCE); + //cairo_rectangle(buf.ct, 0, 0, paint_rect.width(), paint_rec.height()); cairo_paint(buf.ct); - cairo_restore(buf.ct); + cairo_set_operator(buf.ct, CAIRO_OPERATOR_OVER); if (_root->visible) { SP_CANVAS_ITEM_GET_CLASS(_root)->render(_root, &buf); @@ -1588,8 +1600,7 @@ void SPCanvas::paintSingleBuffer(Geom::IntRect const &paint_rect, Geom::IntRect } #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) - //cairo_t *xct = gdk_cairo_create(gtk_widget_get_window (widget)); - cairo_t *xct = cairo_create(_backing_store); + cairo_t *xct = gdk_cairo_create(gtk_widget_get_window (widget)); cairo_translate(xct, paint_rect.left() - _x0, paint_rect.top() - _y0); cairo_rectangle(xct, 0, 0, paint_rect.width(), paint_rect.height()); cairo_clip(xct); @@ -1598,12 +1609,6 @@ void SPCanvas::paintSingleBuffer(Geom::IntRect const &paint_rect, Geom::IntRect cairo_paint(xct); cairo_destroy(xct); cairo_surface_destroy(imgs); - - // Mark the painted rectangle clean - markRect(paint_rect, 0); - - gtk_widget_queue_draw_area(GTK_WIDGET(this), paint_rect.left() -_x0, paint_rect.top() - _y0, - paint_rect.width(), paint_rect.height()); } struct PaintRectSetup { @@ -1787,49 +1792,52 @@ void SPCanvas::endForcedFullRedraws() _forced_redraw_limit = -1; } +#if GTK_CHECK_VERSION(3,0,0) gboolean SPCanvas::handle_draw(GtkWidget *widget, cairo_t *cr) { SPCanvas *canvas = SP_CANVAS(widget); - // Blit from the backing store, without regard for the clean region. - // This is necessary because GTK clears the widget for us, which causes - // severe flicker while drawing if we don't blit the old contents. - cairo_set_source_surface(cr, canvas->_backing_store, 0, 0); - cairo_paint(cr); - cairo_rectangle_list_t *rects = cairo_copy_clip_rectangle_list(cr); - cairo_region_t *dirty_region = cairo_region_create(); for (int i = 0; i < rects->num_rectangles; i++) { cairo_rectangle_t rectangle = rects->rectangles[i]; - Geom::Rect dr = Geom::Rect::from_xywh(rectangle.x + canvas->_x0, rectangle.y + canvas->_y0, - rectangle.width, rectangle.height); - Geom::IntRect ir = dr.roundOutwards(); - cairo_rectangle_int_t irect = { ir.left(), ir.top(), ir.width(), ir.height() }; - cairo_region_union_rectangle(dirty_region, &irect); - } - cairo_rectangle_list_destroy(rects); - cairo_region_subtract(dirty_region, canvas->_clean_region); - // Render the dirty portion in the background - if (!cairo_region_is_empty(dirty_region)) { - canvas->addIdle(); + Geom::IntRect r = Geom::IntRect::from_xywh(rectangle.x + canvas->_x0, rectangle.y + canvas->_y0, + rectangle.width, rectangle.height); + + canvas->requestRedraw(r.left(), r.top(), r.right(), r.bottom()); } - cairo_region_destroy(dirty_region); - return TRUE; + cairo_rectangle_list_destroy(rects); + + return FALSE; } -#if !GTK_CHECK_VERSION(3,0,0) +#else gboolean SPCanvas::handle_expose(GtkWidget *widget, GdkEventExpose *event) { - cairo_t *cr = gdk_cairo_create(gtk_widget_get_window(widget)); + SPCanvas *canvas = SP_CANVAS(widget); + + if (!gtk_widget_is_drawable (widget) || + (event->window != getWindow(canvas))) { + return FALSE; + } + + int n_rects = 0; + GdkRectangle *rects = NULL; + gdk_region_get_rectangles(event->region, &rects, &n_rects); - gdk_cairo_region (cr, event->region); - cairo_clip (cr); - gboolean result = SPCanvas::handle_draw(widget, cr); + if(rects == NULL) + return FALSE; + + for (int i = 0; i < n_rects; i++) { + GdkRectangle rectangle = rects[i]; - cairo_destroy (cr); + Geom::IntRect r = Geom::IntRect::from_xywh(rectangle.x + canvas->_x0, rectangle.y + canvas->_y0, + rectangle.width, rectangle.height); + + canvas->requestRedraw(r.left(), r.top(), r.right(), r.bottom()); + } - return result; + return FALSE; } #endif @@ -1882,22 +1890,42 @@ int SPCanvas::paint() _need_update = FALSE; } - GtkAllocation allocation; - gtk_widget_get_allocation(GTK_WIDGET(this), &allocation); - cairo_rectangle_int_t crect = { _x0, _y0, allocation.width, allocation.height }; - cairo_region_t *to_draw = cairo_region_create_rectangle(&crect); - cairo_region_subtract(to_draw, _clean_region); + if (!_need_redraw) { + return TRUE; + } - int n_rects = cairo_region_num_rectangles(to_draw); - for (int i = 0; i < n_rects; ++i) { - cairo_rectangle_int_t crect; - cairo_region_get_rectangle(to_draw, i, &crect); - if (!paintRect(crect.x, crect.y, crect.x + crect.width, crect.y + crect.height)) { - // Aborted - return FALSE; - }; + Cairo::RefPtr to_paint = Cairo::Region::create(); + + for (int j = _tTop; j < _tBottom; ++j) { + for (int i = _tLeft; i < _tRight; ++i) { + int tile_index = (i - _tLeft) + (j - _tTop) * _tile_h; + + if (_tiles[tile_index]) { // if this tile is dirtied (nonzero) + Cairo::RectangleInt rect = {i*TILE_SIZE, j*TILE_SIZE, + TILE_SIZE, TILE_SIZE}; + to_paint->do_union(rect); + } + } + } + + int n_rect = to_paint->get_num_rectangles(); + + if (n_rect > 0) { + for (int i=0; i < n_rect; i++) { + Cairo::RectangleInt rect = to_paint->get_rectangle(i); + int x0 = rect.x; + int y0 = rect.y; + int x1 = x0 + rect.width; + int y1 = y0 + rect.height; + if (!paintRect(x0, y0, x1, y1)) { + // Aborted + return FALSE; + }; + } } + _need_redraw = FALSE; + // we've had a full unaborted redraw, reset the full redraw counter if (_forced_redraw_limit != -1) { _forced_redraw_count = 0; @@ -1976,41 +2004,15 @@ void SPCanvas::scrollTo(double cx, double cy, unsigned int clear, bool is_scroll Geom::IntRect old_area = getViewboxIntegers(); Geom::IntRect new_area = old_area + Geom::IntPoint(dx, dy); - - gtk_widget_get_allocation(&_widget, &allocation); - - // adjust backing store contents - assert(_backing_store); - cairo_surface_t *new_backing_store = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, - allocation.width, allocation.height); - cairo_t *cr = cairo_create(new_backing_store); - cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); - // Paint the background - cairo_translate(cr, -ix, -iy); - cairo_set_source(cr, _background); - cairo_paint(cr); - // Copy the old backing store contents - cairo_set_source_surface(cr, _backing_store, _x0, _y0); - cairo_rectangle(cr, _x0, _y0, allocation.width, allocation.height); - cairo_clip(cr); - cairo_paint(cr); - cairo_destroy(cr); - cairo_surface_destroy(_backing_store); - _backing_store = new_backing_store; - + _dx0 = cx; // here the 'd' stands for double, not delta! _dy0 = cy; _x0 = ix; _y0 = iy; - // Adjust the clean region - if (clear) { - dirtyAll(); - } else { - cairo_rectangle_int_t crect = { _x0, _y0, allocation.width, allocation.height }; - cairo_region_intersect_rectangle(_clean_region, &crect); - } + gtk_widget_get_allocation(&_widget, &allocation); + resizeTiles(_x0, _y0, _x0 + allocation.width, _y0 + allocation.height); if (SP_CANVAS_ITEM_GET_CLASS(_root)->viewbox_changed) { SP_CANVAS_ITEM_GET_CLASS(_root)->viewbox_changed(_root, new_area); } @@ -2018,17 +2020,19 @@ void SPCanvas::scrollTo(double cx, double cy, unsigned int clear, bool is_scroll if (!clear) { // scrolling without zoom; redraw only the newly exposed areas if ((dx != 0) || (dy != 0)) { + this->_is_scrolling = is_scrolling; if (gtk_widget_get_realized(GTK_WIDGET(this))) { gdk_window_scroll(getWindow(this), -dx, -dy); } } + } else { + // scrolling as part of zoom; do nothing here - the next do_update will perform full redraw } - addIdle(); } void SPCanvas::updateNow() { - if (_need_update) { + if (_need_update || _need_redraw) { doUpdate(); } } @@ -2041,45 +2045,26 @@ void SPCanvas::requestUpdate() void SPCanvas::requestRedraw(int x0, int y0, int x1, int y1) { + GtkAllocation allocation; + if (!gtk_widget_is_drawable( GTK_WIDGET(this) )) { return; } - if (x0 >= x1 || y0 >= y1) { + if ((x0 >= x1) || (y0 >= y1)) { return; } Geom::IntRect bbox(x0, y0, x1, y1); - dirtyRect(bbox); - addIdle(); -} - -void SPCanvas::setBackgroundColor(guint32 rgba) { - double new_r = SP_RGBA32_R_F(rgba); - double new_g = SP_RGBA32_G_F(rgba); - double new_b = SP_RGBA32_B_F(rgba); - if (!_background_is_checkerboard) { - double old_r, old_g, old_b; - cairo_pattern_get_rgba(_background, &old_r, &old_g, &old_b, NULL); - if (new_r == old_r && new_g == old_g && new_b == old_b) return; - } - if (_background) { - cairo_pattern_destroy(_background); - } - _background = cairo_pattern_create_rgb(new_r, new_g, new_b); - _background_is_checkerboard = false; - dirtyAll(); - addIdle(); -} + gtk_widget_get_allocation(GTK_WIDGET(this), &allocation); -void SPCanvas::setBackgroundCheckerboard() { - if (_background_is_checkerboard) return; - if (_background) { - cairo_pattern_destroy(_background); + Geom::IntRect canvas_rect = Geom::IntRect::from_xywh(this->_x0, this->_y0, + allocation.width, allocation.height); + + Geom::OptIntRect clip = bbox & canvas_rect; + if (clip) { + dirtyRect(*clip); + addIdle(); } - _background = ink_cairo_pattern_create_checkerboard(); - _background_is_checkerboard = true; - dirtyAll(); - addIdle(); } /** @@ -2183,24 +2168,63 @@ inline int sp_canvas_tile_ceil(int x) return ((x + (TILE_SIZE - 1)) & (~(TILE_SIZE - 1))) / TILE_SIZE; } -void SPCanvas::dirtyRect(Geom::IntRect const &area) { - markRect(area, 1); +void SPCanvas::resizeTiles(int nl, int nt, int nr, int nb) +{ + if ( nl >= nr || nt >= nb ) { + if (_tiles) g_free(_tiles); + _tLeft = _tTop = _tRight = _tBottom = 0; + _tile_h = _tile_h = 0; + _tiles = NULL; + return; + } + int tl = sp_canvas_tile_floor(nl); + int tt = sp_canvas_tile_floor(nt); + int tr = sp_canvas_tile_ceil(nr); + int tb = sp_canvas_tile_ceil(nb); + + int nh = tr-tl, nv = tb-tt; + uint8_t *ntiles = (uint8_t*) g_malloc(nh * nv * sizeof(uint8_t)); + for (int i = tl; i < tr; i++) { + for (int j = tt; j < tb; j++) { + int ind = (i-tl) + (j-tt)*nh; + if ( i >= _tLeft && i < _tRight && j >= _tTop && j < _tBottom ) { + ntiles[ind] = _tiles[(i - _tLeft) + (j - _tTop) * _tile_h]; // copy from the old tile + } else { + ntiles[ind] = 0; // newly exposed areas get 0 + } + } + } + if (_tiles) g_free(_tiles); + _tiles = ntiles; + _tLeft = tl; + _tTop = tt; + _tRight = tr; + _tBottom = tb; + _tile_h = nh; + _tile_h = nv; } -void SPCanvas::dirtyAll() { - if (_clean_region && !cairo_region_is_empty(_clean_region)) { - cairo_region_destroy(_clean_region); - _clean_region = cairo_region_create(); - } +void SPCanvas::dirtyRect(Geom::IntRect const &area) { + _need_redraw = TRUE; + markRect(area, 1); } void SPCanvas::markRect(Geom::IntRect const &area, uint8_t val) { - cairo_rectangle_int_t crect = { area.left(), area.top(), area.width(), area.height() }; - if (val) { - cairo_region_subtract_rectangle(_clean_region, &crect); - } else { - cairo_region_union_rectangle(_clean_region, &crect); + int tl = sp_canvas_tile_floor(area.left()); + int tt = sp_canvas_tile_floor(area.top()); + int tr = sp_canvas_tile_ceil(area.right()); + int tb = sp_canvas_tile_ceil(area.bottom()); + if ( tl >= _tRight || tr <= _tLeft || tt >= _tBottom || tb <= _tTop ) return; + if ( tl < _tLeft ) tl = _tLeft; + if ( tr > _tRight ) tr = _tRight; + if ( tt < _tTop ) tt = _tTop; + if ( tb > _tBottom ) tb = _tBottom; + + for (int i=tl; i * Lauris Kaplinski * Jon A. Cruz - * Krzysztof Kosiński * * Copyright (C) 1998 The Free Software Foundation * Copyright (C) 2002 Lauris Kaplinski - * Copyright (C) 2016 Google Inc. * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -87,9 +85,6 @@ struct SPCanvas { Geom::IntRect getViewboxIntegers() const; SPCanvasGroup *getRoot(); - void setBackgroundColor(guint32 rgba); - void setBackgroundCheckerboard(); - /// Returns new canvas as widget. static GtkWidget *createAA(); @@ -108,8 +103,7 @@ private: /// Marks the specified area as dirty (requiring redraw) void dirtyRect(Geom::IntRect const &area); - /// Marks the whole widget for redraw - void dirtyAll(); + /// Marks specific canvas rectangle as clean (val == 0) or dirty (otherwise) void markRect(Geom::IntRect const &area, uint8_t val); /// Invokes update, paint, and repick on canvas. @@ -161,8 +155,9 @@ public: */ static gint handle_scroll(GtkWidget *widget, GdkEventScroll *event); static gint handle_motion(GtkWidget *widget, GdkEventMotion *event); +#if GTK_CHECK_VERSION(3,0,0) static gboolean handle_draw(GtkWidget *widget, cairo_t *cr); -#if !GTK_CHECK_VERSION(3,0,0) +#else static gboolean handle_expose(GtkWidget *widget, GdkEventExpose *event); #endif static gint handle_key_event(GtkWidget *widget, GdkEventKey *event); @@ -181,18 +176,15 @@ public: bool _is_dragging; double _dx0; double _dy0; - int _x0; ///< World coordinate of the leftmost pixels - int _y0; ///< World coordinate of the topmost pixels - - /// Image surface storing the contents of the widget - cairo_surface_t *_backing_store; - /// Area of the widget that has up-to-date content - cairo_region_t *_clean_region; - /// Widget background, defaults to white - cairo_pattern_t *_background; - bool _background_is_checkerboard; - - /// Last known modifier state, for deferred repick when a button is down. + int _x0; + int _y0; + + /* Area that needs redrawing, stored as a microtile array */ + int _tLeft, _tTop, _tRight, _tBottom; + int _tile_w, _tile_h; + uint8_t *_tiles; + + /** Last known modifier state, for deferred repick when a button is down. */ int _state; /** The item containing the mouse pointer, or NULL if none. */ @@ -216,6 +208,7 @@ public: int _close_enough; unsigned int _need_update : 1; + unsigned int _need_redraw : 1; unsigned int _need_repick : 1; int _forced_redraw_count; -- cgit v1.2.3