From: mental Date: Tue, 1 Jan 2008 04:40:39 +0000 (+0000) Subject: fix update on layer switch and work around some blur-related glitches X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=4424b8328f6e253450bb7015c223257bb5bcd7be;p=inkscape.git fix update on layer switch and work around some blur-related glitches --- diff --git a/src/ui/dialog/fill-and-stroke.cpp b/src/ui/dialog/fill-and-stroke.cpp index 43a9bb989..dd9404933 100644 --- a/src/ui/dialog/fill-and-stroke.cpp +++ b/src/ui/dialog/fill-and-stroke.cpp @@ -43,7 +43,7 @@ FillAndStroke::FillAndStroke() _page_fill(1, 1, true, true), _page_stroke_paint(1, 1, true, true), _page_stroke_style(1, 1, true, true), - _composite_settings(SP_VERB_DIALOG_FILL_STROKE, "fillstroke") + _composite_settings(SP_VERB_DIALOG_FILL_STROKE, "fillstroke", true) { Gtk::Box *contents = _getContents(); contents->set_spacing(0); diff --git a/src/ui/widget/filter-effect-chooser.cpp b/src/ui/widget/filter-effect-chooser.cpp index f8aee43f0..fb901526f 100644 --- a/src/ui/widget/filter-effect-chooser.cpp +++ b/src/ui/widget/filter-effect-chooser.cpp @@ -21,7 +21,7 @@ namespace Inkscape { namespace UI { namespace Widget { -SimpleFilterModifier::SimpleFilterModifier() +SimpleFilterModifier::SimpleFilterModifier(bool blur_enabled) : _lb_blend(_("_Blend mode:")), _lb_blur(_("B_lur:"), Gtk::ALIGN_LEFT), _blend(BlendModeConverter), @@ -31,8 +31,10 @@ SimpleFilterModifier::SimpleFilterModifier() add(_vb_blur); _hb_blend.pack_start(_lb_blend, false, false); _hb_blend.pack_start(_blend); - _vb_blur.add(_lb_blur); - _vb_blur.add(_blur); + if (blur_enabled) { + _vb_blur.add(_lb_blur); + _vb_blur.add(_blur); + } show_all_children(); diff --git a/src/ui/widget/filter-effect-chooser.h b/src/ui/widget/filter-effect-chooser.h index f0d6f324d..740a7fe5e 100644 --- a/src/ui/widget/filter-effect-chooser.h +++ b/src/ui/widget/filter-effect-chooser.h @@ -32,7 +32,7 @@ namespace Widget { class SimpleFilterModifier : public Gtk::VBox { public: - SimpleFilterModifier(); + SimpleFilterModifier(bool blur_enabled); sigc::signal& signal_blend_blur_changed(); diff --git a/src/ui/widget/object-composite-settings.cpp b/src/ui/widget/object-composite-settings.cpp index 20fdbed03..5c38a1370 100644 --- a/src/ui/widget/object-composite-settings.cpp +++ b/src/ui/widget/object-composite-settings.cpp @@ -41,16 +41,17 @@ void ObjectCompositeSettings::_on_desktop_switch( } } -ObjectCompositeSettings::ObjectCompositeSettings(unsigned int verb_code, char const *history_prefix) +ObjectCompositeSettings::ObjectCompositeSettings(unsigned int verb_code, char const *history_prefix, bool blur_enabled) : _verb_code(verb_code), - _opacity_tag(Glib::ustring(history_prefix) + ":opacity"), _blur_tag(Glib::ustring(history_prefix) + ":blur"), + _opacity_tag(Glib::ustring(history_prefix) + ":opacity"), _opacity_vbox(false, 0), _opacity_label_box(false, 0), _opacity_label(_("Opacity, %"), 0.0, 1.0, true), _opacity_adjustment(100.0, 0.0, 100.0, 1.0, 1.0, 0.0), _opacity_hscale(_opacity_adjustment), _opacity_spin_button(_opacity_adjustment, 0.01, 1), + _fe_cb(blur_enabled), _fe_vbox(false, 0), _fe_alignment(1, 1, 1, 1), _blocked(false) @@ -111,14 +112,15 @@ ObjectCompositeSettings::_blendBlurValueChanged() sp_canvas_force_full_redraw_after_interruptions(sp_desktop_canvas(desktop), 0); NR::Maybe bbox = _subject->getBounds(); - if (!bbox) { - return; + double radius; + if (bbox) { + double perimeter = bbox->extent(NR::X) + bbox->extent(NR::Y); + radius = _fe_cb.get_blur_value() * perimeter / 400; + } else { + radius = 0; } - double perimeter = bbox->extent(NR::X) + bbox->extent(NR::Y); - const Glib::ustring blendmode = _fe_cb.get_blend_mode(); - double radius = _fe_cb.get_blur_value() * perimeter / 400; SPFilter *filter = 0; const bool remfilter = (blendmode == "normal" && radius == 0) || (blendmode == "filter" && !filter); diff --git a/src/ui/widget/object-composite-settings.h b/src/ui/widget/object-composite-settings.h index 8768157bf..6cef739d7 100644 --- a/src/ui/widget/object-composite-settings.h +++ b/src/ui/widget/object-composite-settings.h @@ -31,7 +31,7 @@ namespace Widget { class ObjectCompositeSettings : public Gtk::VBox { public: - ObjectCompositeSettings(unsigned int verb_code, char const *history_prefix); + ObjectCompositeSettings(unsigned int verb_code, char const *history_prefix, bool blur_enabled=false); ~ObjectCompositeSettings(); void setSubject(StyleSubject *subject); diff --git a/src/ui/widget/style-subject.cpp b/src/ui/widget/style-subject.cpp index f7864acc3..46d33abb7 100644 --- a/src/ui/widget/style-subject.cpp +++ b/src/ui/widget/style-subject.cpp @@ -124,6 +124,7 @@ void StyleSubject::CurrentLayer::_setLayer(SPObject *layer) { _layer_release = layer->connectRelease(sigc::hide(sigc::bind(sigc::mem_fun(*this, &CurrentLayer::_setLayer), (SPObject *)NULL))); _layer_modified = layer->connectModified(sigc::hide(sigc::hide(sigc::mem_fun(*this, &CurrentLayer::_emitChanged)))); } + _emitChanged(); } SPObject *StyleSubject::CurrentLayer::_getLayer() const {