Code

Filter effects dialog:
[inkscape.git] / src / ui / widget / filter-effect-chooser.h
1 #ifndef __FILTER_EFFECT_CHOOSER_H__
2 #define __FILTER_EFFECT_CHOOSER_H__
4 /*
5  * Filter effect selection selection widget
6  *
7  * Author:
8  *   Nicholas Bishop <nicholasbishop@gmail.com>
9  *
10  * Copyright (C) 2007 Authors
11  *
12  * Released under GNU GPL, read the file 'COPYING' for more information
13  */
15 #include <gtkmm/box.h>
16 #include <gtkmm/combobox.h>
17 #include <gtkmm/liststore.h>
18 #include <gtkmm/treeview.h>
20 #include "combo-enums.h"
21 #include "filter-enums.h"
22 #include "labelled.h"
23 #include "spin-slider.h"
24 #include "sp-filter.h"
26 namespace Inkscape {
27 namespace UI {
28 namespace Widget {
30 class FilterEffectChooser
31 {
32 public:
33     virtual ~FilterEffectChooser();
35     virtual Glib::SignalProxy0<void> signal_selection_changed() = 0;
36     virtual SPFilter* get_selected_filter() = 0;
37     virtual void select_filter(const SPFilter*) = 0;
38 protected:
39     FilterEffectChooser();
41     class Columns : public Gtk::TreeModel::ColumnRecord
42     {
43     public:
44         Columns()
45         {
46             add(filter);
47             add(label);
48             add(sel);
49         }
51         Gtk::TreeModelColumn<SPFilter*> filter;
52         Gtk::TreeModelColumn<Glib::ustring> label;
53         Gtk::TreeModelColumn<int> sel;
54     };
56     virtual void update_filters();
58     Glib::RefPtr<Gtk::ListStore> _model;
59     Columns _columns;
60 private:
61     static void on_activate_desktop(Inkscape::Application*, SPDesktop*, FilterEffectChooser*);
62     void on_document_replaced(SPDesktop*, SPDocument*);
64     sigc::connection _doc_replaced;
65     sigc::connection _resource_changed;
67     Gtk::TreeView::Column _filter_column;
68 };
70 /* Allows basic control over feBlend and feGaussianBlur effects,
71    with an option to use the full filter effect controls. */
72 class SimpleFilterModifier : public Gtk::VBox, public FilterEffectChooser
73 {
74 public:
75     SimpleFilterModifier();
77     virtual Glib::SignalProxy0<void> signal_selection_changed();
78     virtual SPFilter* get_selected_filter();
79     virtual void select_filter(const SPFilter*);
81     sigc::signal<void>& signal_blend_blur_changed();
83     const Glib::ustring get_blend_mode();
84     // Uses blend mode enum values, or -1 for a complex filter
85     void set_blend_mode(const int);
87     double get_blur_value() const;
88     void set_blur_value(const double);
89     void set_blur_sensitive(const bool);
90 protected:
91     virtual void update_filters();
92 private:
93     void show_filter_dialog();
94     void blend_mode_changed();
96     Gtk::HBox _hb_blend;
97     Gtk::VBox _vb_blur;
98     Gtk::HBox _hb_filter, _hb_filter_sub;
99     Gtk::Label _lb_blend, _lb_blur, _lb_filter;
100     ComboBoxEnum<NR::FilterBlendMode> _blend;
101     SpinSlider _blur;
102     Gtk::ComboBox _filter;
103     Gtk::Button _edit_filters;
105     sigc::signal<void> _signal_blend_blur_changed;
106 };
112 #endif
114 /*
115   Local Variables:
116   mode:c++
117   c-file-style:"stroustrup"
118   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
119   indent-tabs-mode:nil
120   fill-column:99
121   End:
122 */
123 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :