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