~ubuntu-branches/debian/experimental/inkscape/experimental

« back to all changes in this revision

Viewing changes to src/ui/widget/filter-effect-chooser.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Viehmann
  • Date: 2008-09-09 23:29:02 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20080909232902-c50iujhk1w79u8e7
Tags: 0.46-2.1
* Non-maintainer upload.
* Add upstream patch fixing a crash in the open dialog
  in the zh_CN.utf8 locale. Closes: #487623.
  Thanks to Luca Bruno for the patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 */
 
11
 
 
12
#include <glibmm/i18n.h>
 
13
 
 
14
#include "desktop.h"
 
15
#include "desktop-handles.h"
 
16
#include "document.h"
 
17
#include "filter-effect-chooser.h"
 
18
#include "inkscape.h"
 
19
 
 
20
namespace Inkscape {
 
21
namespace UI {
 
22
namespace Widget {
 
23
 
 
24
SimpleFilterModifier::SimpleFilterModifier(int flags)
 
25
    : _lb_blend(_("_Blend mode:")),
 
26
      _lb_blur(_("B_lur:"), Gtk::ALIGN_LEFT),
 
27
      _blend(BlendModeConverter),
 
28
      _blur(0, 0, 100, 1, 0.01, 1)
 
29
{
 
30
    if (flags & BLEND) {
 
31
        add(_hb_blend);
 
32
        _hb_blend.pack_start(_lb_blend, false, false);
 
33
        _hb_blend.pack_start(_blend);
 
34
    }
 
35
    if (flags & BLUR) {
 
36
        add(_vb_blur);
 
37
        _vb_blur.add(_lb_blur);
 
38
        _vb_blur.add(_blur);
 
39
    }
 
40
 
 
41
    show_all_children();
 
42
 
 
43
    _hb_blend.set_spacing(12);
 
44
    _lb_blend.set_use_underline();
 
45
    _lb_blend.set_mnemonic_widget(_blend);
 
46
    _lb_blur.set_use_underline();
 
47
    _lb_blur.set_mnemonic_widget(_blur.get_scale());
 
48
    _blend.signal_changed().connect(signal_blend_blur_changed());
 
49
    _blur.signal_value_changed().connect(signal_blend_blur_changed());
 
50
}
 
51
 
 
52
sigc::signal<void>& SimpleFilterModifier::signal_blend_blur_changed()
 
53
{
 
54
    return _signal_blend_blur_changed;
 
55
}
 
56
 
 
57
const Glib::ustring SimpleFilterModifier::get_blend_mode()
 
58
{
 
59
    return _blend.get_active_row_number() == 5 ? "filter" : _blend.get_active_data()->key;
 
60
}
 
61
 
 
62
void SimpleFilterModifier::set_blend_mode(const int val)
 
63
{
 
64
    _blend.set_active(val);
 
65
}
 
66
 
 
67
double SimpleFilterModifier::get_blur_value() const
 
68
{
 
69
    return _blur.get_value();
 
70
}
 
71
 
 
72
void SimpleFilterModifier::set_blur_value(const double val)
 
73
{
 
74
    _blur.set_value(val);
 
75
}
 
76
 
 
77
void SimpleFilterModifier::set_blur_sensitive(const bool s)
 
78
{
 
79
    _blur.set_sensitive(s);
 
80
}
 
81
 
 
82
}
 
83
}
 
84
}
 
85
 
 
86
/*
 
87
  Local Variables:
 
88
  mode:c++
 
89
  c-file-style:"stroustrup"
 
90
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
 
91
  indent-tabs-mode:nil
 
92
  fill-column:99
 
93
  End:
 
94
*/
 
95
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :