Code

fix update on layer switch and work around some blur-related glitches
authormental <mental@users.sourceforge.net>
Tue, 1 Jan 2008 04:40:39 +0000 (04:40 +0000)
committermental <mental@users.sourceforge.net>
Tue, 1 Jan 2008 04:40:39 +0000 (04:40 +0000)
src/ui/dialog/fill-and-stroke.cpp
src/ui/widget/filter-effect-chooser.cpp
src/ui/widget/filter-effect-chooser.h
src/ui/widget/object-composite-settings.cpp
src/ui/widget/object-composite-settings.h
src/ui/widget/style-subject.cpp

index 43a9bb9894c1fca84322b7aab8d319b1c82019b0..dd94049334248dad1a480097e19f830361bee87b 100644 (file)
@@ -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);
index f8aee43f0f0640fd05809c43e49c9d270d30924a..fb901526f6898395e958da21249db626cfe12ea7 100644 (file)
@@ -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();
 
index f0d6f324db7fccc7cd0a2b5d51773aaa9992c429..740a7fe5e3517aa81b7bade035238232669d56b2 100644 (file)
@@ -32,7 +32,7 @@ namespace Widget {
 class SimpleFilterModifier : public Gtk::VBox
 {
 public:
-    SimpleFilterModifier();
+    SimpleFilterModifier(bool blur_enabled);
 
     sigc::signal<void>& signal_blend_blur_changed();
 
index 20fdbed039b5b3a711faa1d094bf16ef262f1700..5c38a137097bf01f32415aee71fea16978635124 100644 (file)
@@ -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<NR::Rect> 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);
index 8768157bf4eb7176a8456d6156c865620d8ccc76..6cef739d7726fb5829551905a5ffaed7ad15745e 100644 (file)
@@ -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);
index f7864acc362194f8f7689a16b977538fcde82dae..46d33abb7f1ac2b81207ab7d14ab4e5d8d36a7ac 100644 (file)
@@ -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 {