Code

updated spanish.nsh and inkscape.nsi to reflect latest file-changes
[inkscape.git] / trunk / src / ui / widget / filter-effect-chooser.cpp
1 /*
2  * Filter effect selection selection widget
3  *
4  * Author:
5  *   Nicholas Bishop <nicholasbishop@gmail.com>
6  *
7  * Copyright (C) 2007 Authors
8  *
9  * Released under GNU GPL, read the file 'COPYING' for more information
10  */
12 #include <glibmm/i18n.h>
14 #include "desktop.h"
15 #include "desktop-handles.h"
16 #include "document.h"
17 #include "filter-effect-chooser.h"
18 #include "inkscape.h"
20 namespace Inkscape {
21 namespace UI {
22 namespace Widget {
24 SimpleFilterModifier::SimpleFilterModifier(int flags)
25     : _lb_blend(_("_Blend mode:")),
26       _lb_blur(_("B_lur:"), Gtk::ALIGN_LEFT),
27       _blend(BlendModeConverter, SP_ATTR_INVALID, false),
28       _blur(0, 0, 100, 1, 0.01, 1)
29 {
30     _flags = flags;
32     if (flags & BLEND) {
33         add(_hb_blend);
34         _hb_blend.pack_start(_lb_blend, false, false);
35         _hb_blend.pack_start(_blend);
36     }
37     if (flags & BLUR) {
38         add(_vb_blur);
39         _vb_blur.add(_lb_blur);
40         _vb_blur.add(_blur);
41     }
43     show_all_children();
45     _hb_blend.set_spacing(12);
46     _lb_blend.set_use_underline();
47     _lb_blend.set_mnemonic_widget(_blend);
48     _lb_blur.set_use_underline();
49     _lb_blur.set_mnemonic_widget(_blur.get_scale());
50     _blend.signal_changed().connect(signal_blend_blur_changed());
51     _blur.signal_value_changed().connect(signal_blend_blur_changed());
52 }
54 sigc::signal<void>& SimpleFilterModifier::signal_blend_blur_changed()
55 {
56     return _signal_blend_blur_changed;
57 }
59 const Glib::ustring SimpleFilterModifier::get_blend_mode()
60 {
61     if (!(_flags & BLEND)) {
62         return "normal";
63     }
64     if (_blend.get_active_row_number() == 5) {
65         return "normal";
66     } else {
67         const Util::EnumData<Inkscape::Filters::FilterBlendMode> *d = _blend.get_active_data();
68         if (d) {
69             return _blend.get_active_data()->key;
70         } else
71             return "normal";
72     }
73 }
75 void SimpleFilterModifier::set_blend_mode(const int val)
76 {
77     _blend.set_active(val);
78 }
80 double SimpleFilterModifier::get_blur_value() const
81 {
82     return _blur.get_value();
83 }
85 void SimpleFilterModifier::set_blur_value(const double val)
86 {
87     _blur.set_value(val);
88 }
90 void SimpleFilterModifier::set_blur_sensitive(const bool s)
91 {
92     _blur.set_sensitive(s);
93 }
95 }
96 }
97 }
99 /*
100   Local Variables:
101   mode:c++
102   c-file-style:"stroustrup"
103   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
104   indent-tabs-mode:nil
105   fill-column:99
106   End:
107 */
108 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :