182ce45ef6b307f4ac4bd6611ba4920eceb9f9d6
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 "filter-effect-enums.h"
21 #include "labelled.h"
22 #include "spin-slider.h"
23 #include "sp-filter.h"
25 namespace Inkscape {
26 namespace UI {
27 namespace Widget {
29 class FilterEffectChooser
30 {
31 public:
32 virtual ~FilterEffectChooser() {}
34 virtual Glib::SignalProxy0<void> signal_selection_changed() = 0;
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(id);
47 }
49 Gtk::TreeModelColumn<SPFilter*> filter;
50 Gtk::TreeModelColumn<Glib::ustring> id;
51 };
53 virtual void update_filters();
55 Glib::RefPtr<Gtk::ListStore> _model;
56 Columns _columns;
57 private:
58 static void on_activate_desktop(Inkscape::Application*, SPDesktop*, FilterEffectChooser*);
59 void on_document_replaced(SPDesktop*, SPDocument*);
61 sigc::connection _doc_replaced;
62 sigc::connection _resource_changed;
64 Gtk::TreeView::Column _filter_column;
65 };
67 /* Allows basic control over feBlend and feGaussianBlur effects,
68 with an option to use the full filter effect controls. */
69 class SimpleFilterModifier : public Gtk::VBox, public FilterEffectChooser
70 {
71 public:
72 SimpleFilterModifier();
74 virtual Glib::SignalProxy0<void> signal_selection_changed();
75 virtual SPFilter* get_selected_filter();
76 virtual void select_filter(const SPFilter*);
78 sigc::signal<void>& signal_blend_blur_changed();
80 const Glib::ustring get_blend_mode();
81 // Uses blend mode enum values, or -1 for a complex filter
82 void set_blend_mode(const int);
84 double get_blur_value() const;
85 void set_blur_value(const double);
86 void set_blur_sensitive(const bool);
87 protected:
88 virtual void update_filters();
89 private:
90 void show_filter_dialog();
91 void blend_mode_changed();
93 Gtk::HBox _hb_blend;
94 Gtk::VBox _vb_blur;
95 Gtk::HBox _hb_filter, _hb_filter_sub;
96 Gtk::Label _lb_blend, _lb_blur, _lb_filter;
97 ComboBoxEnum<NR::FilterBlendMode> _blend;
98 SpinSlider _blur;
99 Gtk::ComboBox _filter;
100 Gtk::Button _edit_filters;
102 sigc::signal<void> _signal_blend_blur_changed;
103 };
105 }
106 }
107 }
109 #endif
111 /*
112 Local Variables:
113 mode:c++
114 c-file-style:"stroustrup"
115 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
116 indent-tabs-mode:nil
117 fill-column:99
118 End:
119 */
120 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :