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 SPFilter* get_selected_filter() = 0;
36 virtual void select_filter(const SPFilter*) = 0;
37 protected:
38 FilterEffectChooser();
40 class Columns : public Gtk::TreeModel::ColumnRecord
41 {
42 public:
43 Columns()
44 {
45 add(filter);
46 add(label);
47 add(sel);
48 }
50 Gtk::TreeModelColumn<SPFilter*> filter;
51 Gtk::TreeModelColumn<Glib::ustring> label;
52 Gtk::TreeModelColumn<int> sel;
53 };
55 virtual void update_filters();
57 Glib::RefPtr<Gtk::ListStore> _model;
58 Columns _columns;
59 private:
60 static void on_activate_desktop(Inkscape::Application*, SPDesktop*, FilterEffectChooser*);
61 void on_document_replaced(SPDesktop*, SPDocument*);
63 sigc::connection _doc_replaced;
64 sigc::connection _resource_changed;
66 Gtk::TreeView::Column _filter_column;
67 };
69 /* Allows basic control over feBlend and feGaussianBlur effects,
70 with an option to use the full filter effect controls. */
71 class SimpleFilterModifier : public Gtk::VBox, public FilterEffectChooser
72 {
73 public:
74 SimpleFilterModifier();
76 Glib::SignalProxy0<void> signal_selection_changed();
77 virtual SPFilter* get_selected_filter();
78 virtual void select_filter(const SPFilter*);
80 sigc::signal<void>& signal_blend_blur_changed();
82 const Glib::ustring get_blend_mode();
83 // Uses blend mode enum values, or -1 for a complex filter
84 void set_blend_mode(const int);
86 double get_blur_value() const;
87 void set_blur_value(const double);
88 void set_blur_sensitive(const bool);
89 protected:
90 virtual void update_filters();
91 private:
92 void show_filter_dialog();
93 void blend_mode_changed();
95 Gtk::HBox _hb_blend;
96 Gtk::VBox _vb_blur;
97 Gtk::HBox _hb_filter, _hb_filter_sub;
98 Gtk::Label _lb_blend, _lb_blur, _lb_filter;
99 ComboBoxEnum<NR::FilterBlendMode> _blend;
100 SpinSlider _blur;
101 Gtk::ComboBox _filter;
102 Gtk::Button _edit_filters;
104 sigc::signal<void> _signal_blend_blur_changed;
105 };
107 }
108 }
109 }
111 #endif
113 /*
114 Local Variables:
115 mode:c++
116 c-file-style:"stroustrup"
117 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
118 indent-tabs-mode:nil
119 fill-column:99
120 End:
121 */
122 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :