From de6d47ed290e02aa4bdc64d6cea5a6c8c20e61c7 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Mon, 23 Oct 2017 00:10:41 +0200 Subject: Fix compilation on Ubuntu Trusty pango_fc_font_map_get_config() is available since pango 1.38 but trusty only has pango 1.36. While calling this function is the "proper" way to get the FcConfig attached to the FontFactory's font map, FcConfigAppFontAddDir() reference says "If config is NULL, the current configuration is used." and it seems to the current configuration is suitable to use in this case (which might change if we ever start to use multiple font maps with different FcConfig's attached but should be fine for now...) --- src/libnrtype/FontFactory.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libnrtype/FontFactory.cpp b/src/libnrtype/FontFactory.cpp index 677b8abe7..95537734d 100644 --- a/src/libnrtype/FontFactory.cpp +++ b/src/libnrtype/FontFactory.cpp @@ -934,7 +934,10 @@ void font_factory::AddFontsDir(char const *utf8dir) dir = g_filename_from_utf8(utf8dir, -1, NULL, NULL, NULL); # endif - FcConfig *conf = pango_fc_font_map_get_config(PANGO_FC_FONT_MAP(fontServer)); + FcConfig *conf = NULL; +# if PANGO_VERSION_CHECK(1,38,0) + pango_fc_font_map_get_config(PANGO_FC_FONT_MAP(fontServer)); +# endif FcBool res = FcConfigAppFontAddDir(conf, (FcChar8 const *)dir); if (res = FcTrue) { g_info("Fonts dir '%s' added successfully.", utf8dir); -- cgit v1.2.3 From 68d1c505514fe4024c72df86d60a57bcb2b827c8 Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Sun, 22 Oct 2017 19:10:24 +0200 Subject: Fix regression after r14761: handle size of selected nodes too big and sticky In r14761 a bug was introduced in ControlManagerImpl::setSelected(), the fixed value _resize was used to set the final value of targetSize for the node instead of item->ctrlResize which is decided conditionally depending on the node state. https://bugs.launchpad.net/inkscape/+bug/1568644 --- src/ui/control-manager.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ui/control-manager.cpp b/src/ui/control-manager.cpp index d0285e467..d0106bfcd 100644 --- a/src/ui/control-manager.cpp +++ b/src/ui/control-manager.cpp @@ -330,10 +330,12 @@ void ControlManagerImpl::setSelected(SPCanvasItem *item, bool selected) if (selected && _resizeOnSelect.count(item->ctrlType)) { item->ctrlResize = 2; + } else { + item->ctrlResize = 0; } // TODO refresh colors - double targetSize = _sizeTable[item->ctrlType][_size - 1] + _resize; + double targetSize = _sizeTable[item->ctrlType][_size - 1] + item->ctrlResize; g_object_set(item, "size", targetSize, NULL); } } -- cgit v1.2.3 From 7d6099e1503637df0505a2459b57b34dc291ad97 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Mon, 23 Oct 2017 14:55:39 +0200 Subject: Save decl list for 'font-face' rule. Micro-step in supporting rule. --- src/sp-style-elem.cpp | 67 ++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 48 insertions(+), 19 deletions(-) diff --git a/src/sp-style-elem.cpp b/src/sp-style-elem.cpp index 1a3c194b9..2deaccad0 100644 --- a/src/sp-style-elem.cpp +++ b/src/sp-style-elem.cpp @@ -281,8 +281,10 @@ start_font_face_cb(CRDocHandler *a_handler, static_cast(parse_tmp.currStmt), unsigned(parse_tmp.stmtType)); // fixme: Check whether we need to unref currStmt if non-NULL. } + CRStatement *font_face_rule = cr_statement_new_at_font_face_rule (parse_tmp.stylesheet, NULL); + g_return_if_fail(font_face_rule && font_face_rule->type == AT_FONT_FACE_RULE_STMT); parse_tmp.stmtType = FONT_FACE_STMT; - parse_tmp.currStmt = NULL; + parse_tmp.currStmt = font_face_rule; } static void @@ -291,12 +293,26 @@ end_font_face_cb(CRDocHandler *a_handler) g_return_if_fail(a_handler->app_data != NULL); ParseTmp &parse_tmp = *static_cast(a_handler->app_data); g_return_if_fail(parse_tmp.hasMagic()); - if (parse_tmp.stmtType != FONT_FACE_STMT || parse_tmp.currStmt != NULL) { - g_warning("Expecting currStmt==NULL and stmtType==1 (FONT_FACE_STMT) at end of @font-face, but found currStmt=%p, stmtType=%u", - static_cast(parse_tmp.currStmt), unsigned(parse_tmp.stmtType)); - // fixme: Check whether we need to unref currStmt if non-NULL. - parse_tmp.currStmt = NULL; + + CRStatement *const font_face_rule = parse_tmp.currStmt; + if (parse_tmp.stmtType == FONT_FACE_STMT + && font_face_rule + && font_face_rule->type == AT_FONT_FACE_RULE_STMT) + { + parse_tmp.stylesheet->statements = cr_statement_append(parse_tmp.stylesheet->statements, + font_face_rule); + } else { + g_warning("Found stmtType=%u, stmt=%p, stmt.type=%u.", + unsigned(parse_tmp.stmtType), + font_face_rule, + unsigned(font_face_rule->type)); } + + std::cout << "end_font_face_cb: font face rule unsupported." << std::endl; + cr_declaration_dump (font_face_rule->kind.font_face_rule->decl_list, stdout, 2, TRUE); + printf ("\n"); + + parse_tmp.currStmt = NULL; parse_tmp.stmtType = NO_STMT; } @@ -305,26 +321,38 @@ property_cb(CRDocHandler *const a_handler, CRString *const a_name, CRTerm *const a_value, gboolean const a_important) { + // std::cout << "property_cb: Entrance: " << a_name->stryng->str << ": " << cr_term_to_string(a_value) << std::endl; g_return_if_fail(a_handler && a_name); g_return_if_fail(a_handler->app_data != NULL); ParseTmp &parse_tmp = *static_cast(a_handler->app_data); g_return_if_fail(parse_tmp.hasMagic()); - if (parse_tmp.stmtType == FONT_FACE_STMT) { - if (parse_tmp.currStmt != NULL) { - g_warning("Found non-NULL currStmt %p though stmtType==FONT_FACE_STMT.", parse_tmp.currStmt); - } - /* We currently ignore @font-face descriptors. */ - return; - } + CRStatement *const ruleset = parse_tmp.currStmt; - g_return_if_fail(ruleset - && ruleset->type == RULESET_STMT - && parse_tmp.stmtType == NORMAL_RULESET_STMT); - CRDeclaration *const decl = cr_declaration_new(ruleset, cr_string_dup(a_name), a_value); + g_return_if_fail(ruleset); + + CRDeclaration *const decl = cr_declaration_new (ruleset, cr_string_dup(a_name), a_value); g_return_if_fail(decl); decl->important = a_important; - CRStatus const append_status = cr_statement_ruleset_append_decl(ruleset, decl); - g_return_if_fail(append_status == CR_OK); + + switch (parse_tmp.stmtType) { + + case NORMAL_RULESET_STMT: { + g_return_if_fail (ruleset->type == RULESET_STMT); + CRStatus const append_status = cr_statement_ruleset_append_decl (ruleset, decl); + g_return_if_fail (append_status == CR_OK); + break; + } + case FONT_FACE_STMT: { + g_return_if_fail (ruleset->type == AT_FONT_FACE_RULE_STMT); + CRDeclaration *new_decls = cr_declaration_append (ruleset->kind.font_face_rule->decl_list, decl); + g_return_if_fail (new_decls); + ruleset->kind.font_face_rule->decl_list = new_decls; + break; + } + default: + g_warning ("property_cb: Unhandled stmtType: %u", parse_tmp.stmtType); + return; + } } CRParser* @@ -405,6 +433,7 @@ void SPStyleElem::read_content() { // If style sheet has changed, we need to cascade the entire object tree, top down // Get root, read style, loop through children update_style_recursively( (SPObject *)document->getRoot() ); + // cr_stylesheet_dump (document->style_sheet, stdout); } /** -- cgit v1.2.3 From 8a097e957fac49ee3a34b26776d1b7738a11a308 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Mon, 23 Oct 2017 21:34:35 +0200 Subject: UI: Fix canvas scrollbar width a little The underlying issue are the three icons that are squished into the corners of scrollbars/rulers: - in gtk2 they where shrunk down till they fit into the available space (which probably wasn't a great solution either) - in gtk3 they blow up the container till it fits A proper fix would probably be to either a) moving those buttons elsewhere or b) specifically design small buttons/icons for this purpose --- share/ui/style.css | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/share/ui/style.css b/share/ui/style.css index f2883fda4..92b3c412c 100644 --- a/share/ui/style.css +++ b/share/ui/style.css @@ -88,7 +88,8 @@ combobox window.popup scrolledwindow treeview separator { -GtkComboBox-appears-as-list: true; } -#LockGuides { +#LockGuides, +#StickyZoom, +#CMS_Adjust { padding: 0; } - -- cgit v1.2.3 From d9c86888f170593390da648af3ba444acd177d54 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Tue, 24 Oct 2017 13:48:52 +0200 Subject: Give drawing a reasonable(?) default size if dimensions are in % and there is no view box. This prevents a GTK3 crash in file preview (#1611672). --- src/sp-root.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sp-root.cpp b/src/sp-root.cpp index 9ea1aa976..3f31588cc 100644 --- a/src/sp-root.cpp +++ b/src/sp-root.cpp @@ -245,12 +245,12 @@ void SPRoot::setRootDimensions() } else { - if( !this->width._set ) { - this->width.set( SVGLength::PX, 100, 100 ); // Random default + if( !this->width._set || this->width.unit == SVGLength::PERCENT) { + this->width.set( SVGLength::PX, 300, 300 ); // CSS/SVG default } - if( !this->height._set ) { - this->height.set( SVGLength::PX, 100, 100 ); // Random default + if( !this->height._set || this->height.unit == SVGLength::PERCENT) { + this->height.set( SVGLength::PX, 150, 150 ); // CSS/SVG default } } -- cgit v1.2.3 From fd52c97cdbf621ea9e869611be4d5fb9bec90ff7 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Wed, 25 Oct 2017 13:53:33 +0200 Subject: Add limited support for CSS 'font-face' rule. Basically, any ttf or otf file found will be loaded but no custom matching is done nor is the 'font-family' menu updated. --- src/libnrtype/FontFactory.cpp | 32 +++++++++++++++++++++++++ src/libnrtype/FontFactory.h | 3 +++ src/sp-style-elem.cpp | 54 ++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 88 insertions(+), 1 deletion(-) diff --git a/src/libnrtype/FontFactory.cpp b/src/libnrtype/FontFactory.cpp index 95537734d..2b1087eec 100644 --- a/src/libnrtype/FontFactory.cpp +++ b/src/libnrtype/FontFactory.cpp @@ -949,6 +949,38 @@ void font_factory::AddFontsDir(char const *utf8dir) #endif } +void font_factory::AddFontFile(char const *utf8file) +{ +#ifdef USE_PANGO_WIN32 + g_info("Adding additional font only supported for fontconfig backend."); +#else + if (!Inkscape::IO::file_test(utf8file, G_FILE_TEST_IS_REGULAR)) { + g_warning("Font file '%s' does not exist and will be ignored.", utf8file); + return; + } + + gchar *file; +# ifdef WIN32 + file = g_win32_locale_filename_from_utf8(utf8file); +# else + file = g_filename_from_utf8(utf8file, -1, NULL, NULL, NULL); +# endif + + FcConfig *conf = NULL; +# if PANGO_VERSION_CHECK(1,38,0) + pango_fc_font_map_get_config(PANGO_FC_FONT_MAP(fontServer)); +# endif + FcBool res = FcConfigAppFontAddFile(conf, (FcChar8 const *)file); + if (res = FcTrue) { + g_info("Font file '%s' added successfully.", utf8file); + } else { + g_warning("Could not add font file '%s'.", utf8file); + } + + g_free(file); +#endif +} + /* Local Variables: mode:c++ diff --git a/src/libnrtype/FontFactory.h b/src/libnrtype/FontFactory.h index c273be2f4..12260f99a 100644 --- a/src/libnrtype/FontFactory.h +++ b/src/libnrtype/FontFactory.h @@ -139,6 +139,9 @@ public: /// Add a directory from which to include additional fonts void AddFontsDir(char const *utf8dir); + /// Add a an additional font. + void AddFontFile(char const *utf8file); + private: void* loadedPtr; diff --git a/src/sp-style-elem.cpp b/src/sp-style-elem.cpp index 2deaccad0..da02d4ef1 100644 --- a/src/sp-style-elem.cpp +++ b/src/sp-style-elem.cpp @@ -12,6 +12,9 @@ #include #include +// For font-rule +#include "libnrtype/FontFactory.h" + using Inkscape::XML::TEXT_NODE; SPStyleElem::SPStyleElem() : SPObject() { @@ -308,12 +311,61 @@ end_font_face_cb(CRDocHandler *a_handler) unsigned(font_face_rule->type)); } - std::cout << "end_font_face_cb: font face rule unsupported." << std::endl; + std::cout << "end_font_face_cb: font face rule limited support." << std::endl; cr_declaration_dump (font_face_rule->kind.font_face_rule->decl_list, stdout, 2, TRUE); printf ("\n"); + // Get document + SPDocument* document = parse_tmp.document; + if (!document) { + std::cerr << "end_font_face_cb: No document!" << std::endl; + return; + } + if (!document->getURI()) { + std::cerr << "end_font_face_cb: Document URI is NULL" << std::endl; + return; + } + + // Add ttf or otf fonts. + CRDeclaration const *cur = NULL; + for (cur = font_face_rule->kind.font_face_rule->decl_list; cur; cur = cur->next) { + if (cur->property && + cur->property->stryng && + cur->property->stryng->str && + strcmp(cur->property->stryng->str, "src") == 0 ) { + + if (cur->value && + cur->value->content.str && + cur->value->content.str->stryng && + cur->value->content.str->stryng->str) { + + Glib::ustring value = cur->value->content.str->stryng->str; + std::size_t found = value.find_last_of("ttf"); + + if (value.rfind("ttf") == (value.length() - 3) || + value.rfind("otf") == (value.length() - 3)) { + + // Get file + Glib::ustring ttf_file = + Inkscape::IO::Resource::get_filename (document->getURI(), value); + + if (!ttf_file.empty()) { + font_factory *factory = font_factory::Default(); + factory->AddFontFile( ttf_file.c_str() ); + std::cout << "end_font_face_cb: Added font: " << ttf_file << std::endl; + + // FIX ME: Need to refresh font list. + } else { + std::cout << "end_font_face_cb: Failed to add: " << value << std::endl; + } + } + } + } + } + parse_tmp.currStmt = NULL; parse_tmp.stmtType = NO_STMT; + } static void -- cgit v1.2.3 From f346413e6258381d8e30825f22d8cd40fdf806bc Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Wed, 25 Oct 2017 23:05:44 +0200 Subject: Fix code accidentally made useless in de6d47ed290e02aa4bdc64d6cea5a6c8c20e61c7 --- src/libnrtype/FontFactory.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libnrtype/FontFactory.cpp b/src/libnrtype/FontFactory.cpp index 2b1087eec..9c62e5483 100644 --- a/src/libnrtype/FontFactory.cpp +++ b/src/libnrtype/FontFactory.cpp @@ -936,7 +936,7 @@ void font_factory::AddFontsDir(char const *utf8dir) FcConfig *conf = NULL; # if PANGO_VERSION_CHECK(1,38,0) - pango_fc_font_map_get_config(PANGO_FC_FONT_MAP(fontServer)); + conf = pango_fc_font_map_get_config(PANGO_FC_FONT_MAP(fontServer)); # endif FcBool res = FcConfigAppFontAddDir(conf, (FcChar8 const *)dir); if (res = FcTrue) { @@ -968,7 +968,7 @@ void font_factory::AddFontFile(char const *utf8file) FcConfig *conf = NULL; # if PANGO_VERSION_CHECK(1,38,0) - pango_fc_font_map_get_config(PANGO_FC_FONT_MAP(fontServer)); + conf = pango_fc_font_map_get_config(PANGO_FC_FONT_MAP(fontServer)); # endif FcBool res = FcConfigAppFontAddFile(conf, (FcChar8 const *)file); if (res = FcTrue) { -- cgit v1.2.3 From 4dc6e12d293df00624384d525e8b3bdc3d824152 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Thu, 26 Oct 2017 09:42:58 +0200 Subject: Remove unused functions. --- src/widgets/spw-utilities.cpp | 113 ------------------------------------------ src/widgets/spw-utilities.h | 16 ------ 2 files changed, 129 deletions(-) diff --git a/src/widgets/spw-utilities.cpp b/src/widgets/spw-utilities.cpp index 29e86b885..992f1f6b7 100644 --- a/src/widgets/spw-utilities.cpp +++ b/src/widgets/spw-utilities.cpp @@ -61,31 +61,6 @@ Gtk::Label * spw_label(Gtk::Grid *table, const gchar *label_text, int col, int r return label_widget; } -GtkWidget * -spw_label_old(GtkWidget *table, const gchar *label_text, int col, int row) -{ - GtkWidget *label_widget; - - label_widget = gtk_label_new (label_text); - g_assert(label_widget != NULL); - gtk_widget_set_halign(label_widget, GTK_ALIGN_END); - gtk_widget_show (label_widget); - -#if GTK_CHECK_VERSION(3,12,0) - gtk_widget_set_margin_start(label_widget, 4); - gtk_widget_set_margin_end(label_widget, 4); -#else - gtk_widget_set_margin_left(label_widget, 4); - gtk_widget_set_margin_right(label_widget, 4); -#endif - gtk_widget_set_hexpand(label_widget, TRUE); - gtk_widget_set_halign(label_widget, GTK_ALIGN_FILL); - gtk_widget_set_valign(label_widget, GTK_ALIGN_CENTER); - gtk_grid_attach(GTK_GRID(table), label_widget, col, row, 1, 1); - - return label_widget; -} - /** * Creates a horizontal layout manager with 4-pixel spacing between children * and space for 'width' columns. @@ -104,94 +79,6 @@ Gtk::HBox * spw_hbox(Gtk::Grid * table, int width, int col, int row) return hb; } -/** - * Creates a checkbutton widget and adds it to a vbox. - * This is a compound widget that includes a label. - */ -GtkWidget *spw_vbox_checkbutton(GtkWidget *dialog, GtkWidget *vbox, - const gchar *label, const gchar *tip, gchar *key, GCallback cb) -{ - g_assert (dialog != NULL); - g_assert (vbox != NULL); - - GtkWidget *b = gtk_check_button_new_with_label (label); - gtk_widget_set_tooltip_text(b, tip); - g_assert (b != NULL); - gtk_widget_show (b); - gtk_box_pack_start (GTK_BOX (vbox), b, FALSE, FALSE, 0); - g_object_set_data (G_OBJECT (b), "key", key); - g_object_set_data (G_OBJECT (dialog), key, b); - g_signal_connect (G_OBJECT (b), "toggled", cb, dialog); - return b; -} - - -/** - * Creates a checkbutton widget and adds it to a table. - * This is a compound widget that includes a label. - */ -GtkWidget * -spw_checkbutton(GtkWidget * dialog, GtkWidget * table, - const gchar * label, gchar * key, int /*col*/, int row, - int insensitive, GCallback cb) -{ - GtkWidget *b; - - g_assert(dialog != NULL); - g_assert(table != NULL); - - GtkWidget *l = gtk_label_new (label); - gtk_widget_set_halign(l, GTK_ALIGN_END); - gtk_widget_show (l); - - gtk_widget_set_halign(l, GTK_ALIGN_FILL); - gtk_widget_set_hexpand(l, TRUE); - gtk_widget_set_valign(l, GTK_ALIGN_CENTER); - gtk_grid_attach(GTK_GRID(table), l, 0, row, 1, 1); - - b = gtk_check_button_new (); - gtk_widget_show (b); - - gtk_widget_set_halign(b, GTK_ALIGN_FILL); - gtk_widget_set_hexpand(b, TRUE); - gtk_widget_set_valign(b, GTK_ALIGN_CENTER); - gtk_grid_attach(GTK_GRID(table), b, 1, row, 1, 1); - - g_object_set_data (G_OBJECT (b), "key", key); - g_object_set_data (G_OBJECT (dialog), key, b); - g_signal_connect (G_OBJECT (b), "toggled", cb, dialog); - if (insensitive == 1) { - gtk_widget_set_sensitive (b, FALSE); - } - return b; -} - -/** - * Creates a dropdown widget. This is a compound widget that includes - * a label as well as the dropdown. - */ -GtkWidget * -spw_dropdown(GtkWidget * dialog, GtkWidget * table, - const gchar * label_text, gchar * key, int row, - GtkWidget * selector - ) -{ - g_assert(dialog != NULL); - g_assert(table != NULL); - g_assert(selector != NULL); - - spw_label_old(table, label_text, 0, row); - - gtk_widget_show (selector); - gtk_widget_set_halign(selector, GTK_ALIGN_FILL); - gtk_widget_set_hexpand(selector, TRUE); - gtk_widget_set_valign(selector, GTK_ALIGN_CENTER); - gtk_grid_attach(GTK_GRID(table), selector, 1, row, 1, 1); - - g_object_set_data (G_OBJECT (dialog), key, selector); - return selector; -} - static void sp_set_font_size_recursive (GtkWidget *w, gpointer font) { diff --git a/src/widgets/spw-utilities.h b/src/widgets/spw-utilities.h index 71b451631..ea0d55279 100644 --- a/src/widgets/spw-utilities.h +++ b/src/widgets/spw-utilities.h @@ -27,22 +27,6 @@ namespace Gtk { Gtk::Label * spw_label(Gtk::Grid *table, gchar const *label_text, int col, int row, Gtk::Widget *target); Gtk::HBox * spw_hbox(Gtk::Grid *table, int width, int col, int row); -GtkWidget * spw_label_old(GtkWidget *table, gchar const *label_text, int col, int row); - -GtkWidget * -spw_vbox_checkbutton(GtkWidget *dialog, GtkWidget *table, - const gchar *label, const gchar *tip, gchar *key, GCallback cb); - -GtkWidget * -spw_checkbutton(GtkWidget *dialog, GtkWidget *table, - gchar const *label, gchar *key, int col, int row, - int sensitive, GCallback cb); - -GtkWidget * -spw_dropdown(GtkWidget *dialog, GtkWidget *table, - gchar const *label, gchar *key, int row, - GtkWidget *selector - ); void sp_set_font_size (GtkWidget *w, guint font); void sp_set_font_size_smaller (GtkWidget *w); -- cgit v1.2.3 From c8666174565f985a966c9e6ae292f54dda5377c3 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Fri, 27 Oct 2017 10:47:37 +0200 Subject: Try to ensure that panels are created with the correct desktop. Fixes bug #1720096. (Crash under Wayland in gdl code.) --- src/desktop.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/desktop.cpp b/src/desktop.cpp index c56c42267..d8f11a09c 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -1936,10 +1936,16 @@ SPDesktop::show_dialogs() mapVerbPreference.insert(std::make_pair ("ObjectsPanel", "/dialogs/objects") ); mapVerbPreference.insert(std::make_pair ("TagsPanel", "/dialogs/tags") ); + for (std::map::const_iterator iter = mapVerbPreference.begin(); iter != mapVerbPreference.end(); ++iter) { Glib::ustring pref = iter->second; int visible = prefs->getInt(pref + "/visible", 0); if (visible) { + + // Try to ensure that the panel is created attached to the correct desktop (bug 1720096). + // There must be a better way of handling this problem! + INKSCAPE.activate_desktop(this); + _dlg_mgr->showDialog(iter->first.c_str(), false); // without grabbing focus, we need focus to remain on the canvas } } -- cgit v1.2.3 From a00c71b8589567f01ae95ee7a1c8263f97126be9 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Fri, 27 Oct 2017 10:51:47 +0200 Subject: Enable reopening of Prototype dialog on startup. --- src/desktop.cpp | 1 + src/ui/dialog/prototype.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/desktop.cpp b/src/desktop.cpp index d8f11a09c..2d1aa8829 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -1935,6 +1935,7 @@ SPDesktop::show_dialogs() mapVerbPreference.insert(std::make_pair ("Symbols", "/dialogs/symbols") ); mapVerbPreference.insert(std::make_pair ("ObjectsPanel", "/dialogs/objects") ); mapVerbPreference.insert(std::make_pair ("TagsPanel", "/dialogs/tags") ); + mapVerbPreference.insert(std::make_pair ("Prototype", "/dialogs/prototype") ); for (std::map::const_iterator iter = mapVerbPreference.begin(); iter != mapVerbPreference.end(); ++iter) { diff --git a/src/ui/dialog/prototype.cpp b/src/ui/dialog/prototype.cpp index b3bf60aab..b7c9f7abf 100644 --- a/src/ui/dialog/prototype.cpp +++ b/src/ui/dialog/prototype.cpp @@ -22,6 +22,8 @@ namespace Inkscape { namespace UI { namespace Dialog { +// Note that in order for a dialog to be restored, it must be listed in SPDesktop::show_dialogs(). + Prototype::Prototype() : // UI::Widget::Panel("Prototype Label", "/dialogs/prototype", SP_VERB_DIALOG_PROTOTYPE, // "Prototype Apply Label", true), -- cgit v1.2.3 From b2d879e23ef18ce97e71f95d784da4d672874b4b Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Fri, 27 Oct 2017 20:52:00 +0200 Subject: Protect against missing "id". --- src/preferences.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/preferences.cpp b/src/preferences.cpp index 7ebf55a79..b02e71e46 100644 --- a/src/preferences.cpp +++ b/src/preferences.cpp @@ -393,6 +393,9 @@ std::vector Preferences::getAllDirs(Glib::ustring const &path) Inkscape::XML::Node *node = _getNode(path, false); if (node) { for (Inkscape::XML::NodeSiblingIterator i = node->firstChild(); i; ++i) { + if (i->attribute("id") == NULL) { + continue; + } temp.push_back(path + '/' + i->attribute("id")); } } @@ -702,6 +705,9 @@ Inkscape::XML::Node *Preferences::_getNode(Glib::ustring const &pref_key, bool c } for (child = node->firstChild(); child; child = child->next()) { + if (child->attribute("id") == NULL) { + continue; + } if (!strcmp(splits[part_i], child->attribute("id"))) { break; } -- cgit v1.2.3 From d437851688283ae4024e8dc174afcfab2e340301 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sat, 28 Oct 2017 07:25:15 +0200 Subject: Fix XML text parsing bug. Since xml2 2.9.0, xmlNodeGetSpacePreserve() only checks element nodes, thus we need to check text node parent for xml:space value. --- src/xml/repr-io.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp index 725b313b1..2ff9d4776 100644 --- a/src/xml/repr-io.cpp +++ b/src/xml/repr-io.cpp @@ -561,7 +561,10 @@ static Node *sp_repr_svg_read_node (Document *xml_doc, xmlNodePtr node, const gc return NULL; // empty text node } - bool preserve = (xmlNodeGetSpacePreserve (node) == 1); + // Since libxml2 2.9.0, only element nodes are checked, thus check parent. + // Note: this only handles XML's rules for white space. SVG's specific rules + // are handled in sp-string.cpp. + bool preserve = (xmlNodeGetSpacePreserve (node->parent) == 1); xmlChar *p; for (p = node->content; *p && g_ascii_isspace (*p) && !preserve; p++) -- cgit v1.2.3