diff options
| author | Jabiertxof <jtx@jtx> | 2017-05-01 01:21:44 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx> | 2017-05-01 01:21:44 +0000 |
| commit | 3be0cd064d48cfe0601d365fb52f729a776d462b (patch) | |
| tree | 1b4f8c65753bc149ca39f7dac7b381c50351114e /src | |
| parent | minor bugfixing (diff) | |
| parent | Fix erase lpe in multi LPE mode (diff) | |
| download | inkscape-3be0cd064d48cfe0601d365fb52f729a776d462b.tar.gz inkscape-3be0cd064d48cfe0601d365fb52f729a776d462b.zip | |
Update to trunk
(bzr r15620.1.14)
Diffstat (limited to 'src')
| -rw-r--r-- | src/extension/internal/cdr-input.cpp | 13 | ||||
| -rw-r--r-- | src/extension/internal/vsd-input.cpp | 15 | ||||
| -rw-r--r-- | src/live_effects/effect.cpp | 2 | ||||
| -rw-r--r-- | src/live_effects/effect.h | 1 | ||||
| -rw-r--r-- | src/live_effects/lpe-clone-original.cpp | 1 | ||||
| -rw-r--r-- | src/live_effects/lpe-copy_rotate.cpp | 6 | ||||
| -rw-r--r-- | src/live_effects/lpe-measure-line.cpp | 1 | ||||
| -rw-r--r-- | src/live_effects/lpe-mirror_symmetry.cpp | 1 | ||||
| -rw-r--r-- | src/live_effects/parameter/bool.cpp | 2 | ||||
| -rw-r--r-- | src/live_effects/parameter/fontbutton.cpp | 1 | ||||
| -rw-r--r-- | src/live_effects/parameter/parameter.cpp | 6 | ||||
| -rw-r--r-- | src/live_effects/parameter/point.cpp | 2 | ||||
| -rw-r--r-- | src/live_effects/parameter/text.cpp | 2 | ||||
| -rw-r--r-- | src/live_effects/parameter/togglebutton.cpp | 3 | ||||
| -rw-r--r-- | src/sp-lpe-item.cpp | 2 | ||||
| -rw-r--r-- | src/ui/dialog/livepatheffect-editor.cpp | 38 | ||||
| -rw-r--r-- | src/ui/dialog/livepatheffect-editor.h | 4 | ||||
| -rw-r--r-- | src/xml/repr-io.cpp | 7 |
18 files changed, 50 insertions, 57 deletions
diff --git a/src/extension/internal/cdr-input.cpp b/src/extension/internal/cdr-input.cpp index 70bf84ef4..b94408b36 100644 --- a/src/extension/internal/cdr-input.cpp +++ b/src/extension/internal/cdr-input.cpp @@ -210,6 +210,19 @@ void CdrImportDialog::_setPreviewPage() } SPDocument *doc = SPDocument::createNewDocFromMem(_vec[_current_page-1].cstr(), strlen(_vec[_current_page-1].cstr()), 0); + if(!doc) { + g_warning("CDR import: Could not create preview for page %d", _current_page); + gchar const *no_preview_template = + "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'>" + " <path style='fill:none;stroke:#ff0000;stroke-width:2px;' d='M 82,10 18,74 m 0,-64 64,64' />" + " <rect style='fill:none;stroke:#000000;stroke-width:1.5px;' width='64' height='64' x='18' y='10' />" + " <text x='50' y='92' style='font-size:10px;text-anchor:middle;font-family:sans-serif;'>%s</text>" + "</svg>"; + gchar * no_preview = g_strdup_printf(no_preview_template, _("No preview")); + doc = SPDocument::createNewDocFromMem(no_preview, strlen(no_preview), 0); + g_free(no_preview); + } + Gtk::Widget * tmpPreviewArea = Glib::wrap(sp_svg_view_widget_new(doc)); std::swap(_previewArea, tmpPreviewArea); delete tmpPreviewArea; diff --git a/src/extension/internal/vsd-input.cpp b/src/extension/internal/vsd-input.cpp index b7277b99e..c1cfb5cc6 100644 --- a/src/extension/internal/vsd-input.cpp +++ b/src/extension/internal/vsd-input.cpp @@ -146,7 +146,7 @@ VsdImportDialog::VsdImportDialog(const std::vector<RVNGString> &vec) _page_selector_box->pack_start(*_labelTotalPages, Gtk::PACK_SHRINK); vbox1->pack_end(*_page_selector_box, Gtk::PACK_SHRINK); - + // Buttons cancelbutton = Gtk::manage(new Gtk::Button(_("_Cancel"), true)); okbutton = Gtk::manage(new Gtk::Button(_("_OK"), true)); @@ -211,6 +211,19 @@ void VsdImportDialog::_setPreviewPage() } SPDocument *doc = SPDocument::createNewDocFromMem(_vec[_current_page-1].cstr(), strlen(_vec[_current_page-1].cstr()), 0); + if(!doc) { + g_warning("VSD import: Could not create preview for page %d", _current_page); + gchar const *no_preview_template = + "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'>" + " <path style='fill:none;stroke:#ff0000;stroke-width:2px;' d='M 82,10 18,74 m 0,-64 64,64' />" + " <rect style='fill:none;stroke:#000000;stroke-width:1.5px;' width='64' height='64' x='18' y='10' />" + " <text x='50' y='92' style='font-size:10px;text-anchor:middle;font-family:sans-serif;'>%s</text>" + "</svg>"; + gchar * no_preview = g_strdup_printf(no_preview_template, _("No preview")); + doc = SPDocument::createNewDocFromMem(no_preview, strlen(no_preview), 0); + g_free(no_preview); + } + Gtk::Widget * tmpPreviewArea = Glib::wrap(sp_svg_view_widget_new(doc)); std::swap(_previewArea, tmpPreviewArea); delete tmpPreviewArea; diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 22cc5567b..7f34ebf05 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -359,7 +359,6 @@ Effect::Effect(LivePathEffectObject *lpeobject) concatenate_before_pwd2(false), sp_lpe_item(NULL), current_zoom(1), - upd_params(true), sp_shape(NULL), sp_curve(NULL), provides_own_flash_paths(true), // is automatically set to false if providesOwnFlashPaths() is not overridden @@ -782,7 +781,6 @@ Effect::newWidget() ++it; } - upd_params = false; return dynamic_cast<Gtk::Widget *>(vbox); } diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h index c34c391c0..c16bb48ce 100644 --- a/src/live_effects/effect.h +++ b/src/live_effects/effect.h @@ -133,7 +133,6 @@ public: void editNextParamOncanvas(SPItem * item, SPDesktop * desktop); bool apply_to_clippath_and_mask; bool erase_extra_objects; // set this to false allow retain extra generated objects, see measure line LPE - bool upd_params; BoolParam is_visible; SPCurve * sp_curve; Geom::PathVector pathvector_before_effect; diff --git a/src/live_effects/lpe-clone-original.cpp b/src/live_effects/lpe-clone-original.cpp index 47fb6a04e..d97a990af 100644 --- a/src/live_effects/lpe-clone-original.cpp +++ b/src/live_effects/lpe-clone-original.cpp @@ -318,7 +318,6 @@ LPECloneOriginal::newWidget() expander->set_expanded(expanded); expander->property_expanded().signal_changed().connect(sigc::mem_fun(*this, &LPECloneOriginal::onExpanderChanged) ); vbox->pack_start(*expander, true, true, 2); - this->upd_params = false; return dynamic_cast<Gtk::Widget *>(vbox); } diff --git a/src/live_effects/lpe-copy_rotate.cpp b/src/live_effects/lpe-copy_rotate.cpp index 4869e8279..900fc8b67 100644 --- a/src/live_effects/lpe-copy_rotate.cpp +++ b/src/live_effects/lpe-copy_rotate.cpp @@ -362,23 +362,19 @@ LPECopyRotate::doBeforeEffect (SPLPEItem const* lpeitem) using namespace Geom; original_bbox(lpeitem); if (copies_to_360 && num_copies > 2) { - this->upd_params = true; rotation_angle.param_set_value(360.0/(double)num_copies); } if ((method == RM_KALEIDOSCOPE || method == RM_FUSE) && rotation_angle * num_copies > 360.1 && rotation_angle > 0) { - this->upd_params = true; num_copies.param_set_value(floor(360/rotation_angle)); } if ((method == RM_KALEIDOSCOPE || method == RM_FUSE) && mirror_copies && copies_to_360) { - this->upd_params = true; num_copies.param_set_increments(2.0,10.0); if ((int)num_copies%2 !=0) { num_copies.param_set_value(num_copies+1); rotation_angle.param_set_value(360.0/(double)num_copies); } } else { - this->upd_params = true; num_copies.param_set_increments(1.0, 10.0); } @@ -392,7 +388,6 @@ LPECopyRotate::doBeforeEffect (SPLPEItem const* lpeitem) // likely due to SVG's choice of coordinate system orientation (max) bool near = Geom::are_near(previous_start_point, (Geom::Point)starting_point, 0.01); if (!near) { - this->upd_params = true; starting_angle.param_set_value(deg_from_rad(-angle_between(dir, starting_point - origin))); if (GDK_SHIFT_MASK) { dist_angle_handle = L2(B - A); @@ -407,7 +402,6 @@ LPECopyRotate::doBeforeEffect (SPLPEItem const* lpeitem) rot_pos = origin + dir * Rotate(-rad_from_deg(rotation_angle+starting_angle)) * dist_angle_handle; near = Geom::are_near(start_pos, (Geom::Point)starting_point, 0.01); if (!near) { - this->upd_params = true; starting_point.param_setValue(start_pos, true); } previous_start_point = (Geom::Point)starting_point; diff --git a/src/live_effects/lpe-measure-line.cpp b/src/live_effects/lpe-measure-line.cpp index 52aa56fa0..892744462 100644 --- a/src/live_effects/lpe-measure-line.cpp +++ b/src/live_effects/lpe-measure-line.cpp @@ -511,7 +511,6 @@ LPEMeasureLine::doBeforeEffect (SPLPEItem const* lpeitem) pathvector *= writed_transform; if ((Glib::ustring(format.param_getSVGValue()).empty())) { format.param_setValue(Glib::ustring("{measure}{unit}")); - this->upd_params = true; } size_t ncurves = pathvector.curveCount(); if (ncurves != (size_t)curve_linked.param_get_max()) { diff --git a/src/live_effects/lpe-mirror_symmetry.cpp b/src/live_effects/lpe-mirror_symmetry.cpp index 97015c34d..b411bd699 100644 --- a/src/live_effects/lpe-mirror_symmetry.cpp +++ b/src/live_effects/lpe-mirror_symmetry.cpp @@ -335,7 +335,6 @@ LPEMirrorSymmetry::newWidget() ++it; } - this->upd_params = false; return dynamic_cast<Gtk::Widget *>(vbox); } diff --git a/src/live_effects/parameter/bool.cpp b/src/live_effects/parameter/bool.cpp index fafa71368..1df13b11a 100644 --- a/src/live_effects/parameter/bool.cpp +++ b/src/live_effects/parameter/bool.cpp @@ -78,7 +78,6 @@ BoolParam::param_newWidget() checkwdg->setActive(value); checkwdg->setProgrammatically = false; checkwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change bool parameter")); - param_effect->upd_params = false; return dynamic_cast<Gtk::Widget *> (checkwdg); } else { return NULL; @@ -88,7 +87,6 @@ BoolParam::param_newWidget() void BoolParam::param_setValue(bool newvalue) { - param_effect->upd_params = true; value = newvalue; } diff --git a/src/live_effects/parameter/fontbutton.cpp b/src/live_effects/parameter/fontbutton.cpp index 5ec98df8c..89ead122d 100644 --- a/src/live_effects/parameter/fontbutton.cpp +++ b/src/live_effects/parameter/fontbutton.cpp @@ -68,7 +68,6 @@ FontButtonParam::param_newWidget() Glib::ustring fontspec = param_getSVGValue(); fontbuttonwdg->setValue( fontspec); fontbuttonwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change font button parameter")); - param_effect->upd_params = false; return dynamic_cast<Gtk::Widget *> (fontbuttonwdg); } diff --git a/src/live_effects/parameter/parameter.cpp b/src/live_effects/parameter/parameter.cpp index e35c89c09..569736735 100644 --- a/src/live_effects/parameter/parameter.cpp +++ b/src/live_effects/parameter/parameter.cpp @@ -121,7 +121,6 @@ ScalarParam::param_update_default(const gchar * default_value) void ScalarParam::param_set_value(gdouble val) { - param_effect->upd_params = true; value = val; if (integer) value = round(value); @@ -139,7 +138,6 @@ ScalarParam::param_set_range(gdouble min, gdouble max) // Once again, in gtk2, this is not a problem. But in gtk3, // widgets get allocated the amount of size they ask for, // leading to excessively long widgets. - param_effect->upd_params = true; if (min >= -SCALARPARAM_G_MAXDOUBLE) { this->min = min; } else { @@ -156,7 +154,6 @@ ScalarParam::param_set_range(gdouble min, gdouble max) void ScalarParam::param_make_integer(bool yes) { - param_effect->upd_params = true; integer = yes; digits = 0; inc_step = 1; @@ -187,7 +184,6 @@ ScalarParam::param_newWidget() if(!overwrite_widget){ rsu->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change scalar parameter")); } - param_effect->upd_params = false; return dynamic_cast<Gtk::Widget *> (rsu); } else { return NULL; @@ -197,14 +193,12 @@ ScalarParam::param_newWidget() void ScalarParam::param_set_digits(unsigned digits) { - param_effect->upd_params = true; this->digits = digits; } void ScalarParam::param_set_increments(double step, double page) { - param_effect->upd_params = true; inc_step = step; inc_page = page; } diff --git a/src/live_effects/parameter/point.cpp b/src/live_effects/parameter/point.cpp index 561f1b34c..20d8a3392 100644 --- a/src/live_effects/parameter/point.cpp +++ b/src/live_effects/parameter/point.cpp @@ -90,7 +90,6 @@ PointParam::param_setValue(Geom::Point newpoint, bool write) if(knoth && liveupdate){ knoth->update_knots(); } - param_effect->upd_params = true; } bool @@ -143,7 +142,6 @@ PointParam::param_newWidget() Gtk::HBox * hbox = Gtk::manage( new Gtk::HBox() ); static_cast<Gtk::HBox*>(hbox)->pack_start(*pointwdg, true, true); static_cast<Gtk::HBox*>(hbox)->show_all_children(); - param_effect->upd_params = false; return dynamic_cast<Gtk::Widget *> (hbox); } diff --git a/src/live_effects/parameter/text.cpp b/src/live_effects/parameter/text.cpp index 84603149e..4062a4dc7 100644 --- a/src/live_effects/parameter/text.cpp +++ b/src/live_effects/parameter/text.cpp @@ -125,14 +125,12 @@ TextParam::param_newWidget() rsu->setProgrammatically = false; rsu->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change text parameter")); - param_effect->upd_params = false; return dynamic_cast<Gtk::Widget *> (rsu); } void TextParam::param_setValue(const Glib::ustring newvalue) { - param_effect->upd_params = true; value = newvalue; if (!_hide_canvas_text) { sp_canvastext_set_text (canvas_text, newvalue.c_str()); diff --git a/src/live_effects/parameter/togglebutton.cpp b/src/live_effects/parameter/togglebutton.cpp index b8058e9c8..fb4ba3dc4 100644 --- a/src/live_effects/parameter/togglebutton.cpp +++ b/src/live_effects/parameter/togglebutton.cpp @@ -124,7 +124,6 @@ ToggleButtonParam::param_newWidget() checkwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change togglebutton parameter")); _toggled_connection = checkwdg->signal_toggled().connect(sigc::mem_fun(*this, &ToggleButtonParam::toggled)); - param_effect->upd_params = false; return checkwdg; } @@ -171,8 +170,6 @@ ToggleButtonParam::param_setValue(bool newvalue) void ToggleButtonParam::toggled() { - //Force redraw for update widgets - param_effect->upd_params = true; if (SP_ACTIVE_DESKTOP) { Inkscape::Selection *selection = SP_ACTIVE_DESKTOP->getSelection(); selection->emitModified(); diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index ca0f78a00..b5c89b69d 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -493,8 +493,8 @@ void SPLPEItem::removeCurrentPathEffect(bool keep_paths) } PathEffectList new_list = *this->path_effect_list; new_list.remove(lperef); //current lpe ref is always our 'own' pointer from the path_effect_list + *this->path_effect_list = new_list; this->getRepr()->setAttribute("inkscape:path-effect", patheffectlist_svg_string(new_list)); - if (!keep_paths) { // Make sure that ellipse is stored as <svg:circle> or <svg:ellipse> if possible. if( SP_IS_GENERICELLIPSE(this)) { diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index f0ccce6d4..f3fec2df4 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -47,17 +47,18 @@ namespace Dialog { /*#################### * Callback functions */ + + void lpeeditor_selection_changed (Inkscape::Selection * selection, gpointer data) { LivePathEffectEditor *lpeeditor = static_cast<LivePathEffectEditor *>(data); lpeeditor->lpe_list_locked = false; - lpeeditor->onSelectionChanged(selection, true); + lpeeditor->onSelectionChanged(selection); } -static void lpeeditor_selection_modified (Inkscape::Selection * selection, guint /*flags*/, gpointer data) +void lpeeditor_selection_modified (Inkscape::Selection * selection, guint /*flags*/, gpointer data) { - LivePathEffectEditor *lpeeditor = static_cast<LivePathEffectEditor *>(data); - lpeeditor->onSelectionChanged(selection); + lpeeditor_selection_changed (selection, data); } static void lpe_style_button(Gtk::Button& btn, char const* iconName) @@ -184,15 +185,13 @@ LivePathEffectEditor::~LivePathEffectEditor() if (current_desktop) { selection_changed_connection.disconnect(); selection_modified_connection.disconnect(); + selection_moved_connection.disconnect(); } } void LivePathEffectEditor::showParams(LivePathEffect::Effect& effect) { - if ( ! effect.upd_params ) { - return; - } bool expanderopen = false; Gtk::Widget * defaultswidget = effect.defaultParamSet(); if (effectwidget) { @@ -272,16 +271,15 @@ LivePathEffectEditor::set_sensitize_all(bool sensitive) } void -LivePathEffectEditor::onSelectionChanged(Inkscape::Selection *sel, bool upd_params) +LivePathEffectEditor::onSelectionChanged(Inkscape::Selection *sel) { if (lpe_list_locked) { // this was triggered by selecting a row in the list, so skip reloading lpe_list_locked = false; return; } - - effectlist_store->clear(); current_lpeitem = NULL; + effectlist_store->clear(); if ( sel && !sel->isEmpty() ) { SPItem *item = sel->singleItem(); @@ -296,9 +294,6 @@ LivePathEffectEditor::onSelectionChanged(Inkscape::Selection *sel, bool upd_para if ( lpeitem->hasPathEffect() ) { Inkscape::LivePathEffect::Effect *lpe = lpeitem->getCurrentLPE(); if (lpe) { - if (upd_params) { - lpe->upd_params = true; - } showParams(*lpe); lpe_list_locked = true; selectInList(lpe); @@ -502,18 +497,12 @@ LivePathEffectEditor::onRemove() SPItem *item = sel->singleItem(); SPLPEItem *lpeitem = dynamic_cast<SPLPEItem *>(item); if ( lpeitem ) { - if (current_lperef && current_lperef->lpeobject) { - LivePathEffect::Effect * effect = current_lperef->lpeobject->get_lpe(); - if (effect) { - effect->upd_params = true; - } - } lpeitem->removeCurrentPathEffect(false); - + current_lperef = NULL; DocumentUndo::done( current_desktop->getDocument(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Remove path effect") ); - - effect_list_reload(lpeitem); + lpe_list_locked = false; + onSelectionChanged(sel); } } @@ -530,7 +519,7 @@ void LivePathEffectEditor::onUp() DocumentUndo::done( current_desktop->getDocument(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Move path effect up") ); - + effect_list_reload(lpeitem); } } @@ -547,7 +536,6 @@ void LivePathEffectEditor::onDown() DocumentUndo::done( current_desktop->getDocument(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Move path effect down") ); - effect_list_reload(lpeitem); } } @@ -572,7 +560,6 @@ void LivePathEffectEditor::on_effect_selection_changed() current_lperef = lperef; LivePathEffect::Effect * effect = lperef->lpeobject->get_lpe(); if (effect) { - effect->upd_params = true; showParams(*effect); } } @@ -581,6 +568,7 @@ void LivePathEffectEditor::on_effect_selection_changed() void LivePathEffectEditor::on_visibility_toggled( Glib::ustring const& str ) { + Gtk::TreeModel::Children::iterator iter = effectlist_view.get_model()->get_iter(str); Gtk::TreeModel::Row row = *iter; diff --git a/src/ui/dialog/livepatheffect-editor.h b/src/ui/dialog/livepatheffect-editor.h index a7c749ef3..e9769ffea 100644 --- a/src/ui/dialog/livepatheffect-editor.h +++ b/src/ui/dialog/livepatheffect-editor.h @@ -45,7 +45,7 @@ public: static LivePathEffectEditor &getInstance() { return *new LivePathEffectEditor(); } - void onSelectionChanged(Inkscape::Selection *sel, bool upd_params = false); + void onSelectionChanged(Inkscape::Selection *sel); void onSelectionModified(Inkscape::Selection *sel); virtual void on_effect_selection_changed(); void setDesktop(SPDesktop *desktop); @@ -63,6 +63,7 @@ private: sigc::connection desktopChangeConn; sigc::connection selection_changed_connection; sigc::connection selection_modified_connection; + sigc::connection selection_moved_connection; // void add_entry(const char* name ); void effect_list_reload(SPLPEItem *lpeitem); @@ -126,6 +127,7 @@ private: LivePathEffect::LPEObjectReference * current_lperef; friend void lpeeditor_selection_changed (Inkscape::Selection * selection, gpointer data); + friend void lpeeditor_selection_modified (Inkscape::Selection * selection, guint /*flags*/, gpointer data); LivePathEffectEditor(LivePathEffectEditor const &d); LivePathEffectEditor& operator=(LivePathEffectEditor const &d); diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp index ae6f238d4..d8e0f5418 100644 --- a/src/xml/repr-io.cpp +++ b/src/xml/repr-io.cpp @@ -404,7 +404,12 @@ Document *sp_repr_read_mem (const gchar * buffer, gint length, const gchar *defa g_return_val_if_fail (buffer != NULL, NULL); - doc = xmlParseMemory (const_cast<gchar *>(buffer), length); + int parser_options = XML_PARSE_HUGE | XML_PARSE_RECOVER; + parser_options |= XML_PARSE_NONET; // TODO: should we allow network access? + // proper solution would be to check the preference "/options/externalresources/xml/allow_net_access" + // as done in XmlSource::readXml which gets called by the analogous sp_repr_read_file() + // but sp_repr_read_mem() seems to be called in locations where Inkscape::Preferences::get() fails badly + doc = xmlReadMemory (const_cast<gchar *>(buffer), length, NULL, NULL, parser_options); rdoc = sp_repr_do_read (doc, default_ns); if (doc) { |
