summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 62d7503)
raw | patch | inline | side by side (parent: 62d7503)
author | nicholasbishop <nicholasbishop@users.sourceforge.net> | |
Tue, 7 Aug 2007 06:53:24 +0000 (06:53 +0000) | ||
committer | nicholasbishop <nicholasbishop@users.sourceforge.net> | |
Tue, 7 Aug 2007 06:53:24 +0000 (06:53 +0000) |
* Fixed a few bugs with the feColorMatrix settings, such as bad sensitivity settings and missing updates.
* Changed matrix loading (for the values attribute of feColorMatrix) so that it can handle values separated by more than one space.
* Changed matrix loading (for the values attribute of feColorMatrix) so that it can handle values separated by more than one space.
diff --git a/src/helper-fns.h b/src/helper-fns.h
index 29fd2ebec7aabf49e70148d8e4fa39283aa0f83c..4e51c9a161b2d07c2ec1177cbaee7680bb34c6c6 100644 (file)
--- a/src/helper-fns.h
+++ b/src/helper-fns.h
* Released under GNU GPL, read the file 'COPYING' for more information
*/
+#include <sstream>
+
static double
helperfns_read_number(gchar const *value) {
if (!value) return 0;
static std::vector<gdouble> helperfns_read_vector(const gchar* value, int size){
std::vector<gdouble> v(size, (gdouble) 0);
- int i;
- gchar** values = g_strsplit(value , " ", size);
- for (i=0;i<size && values[i];i++)
- v[i] = g_ascii_strtod(values[i], NULL);
+ std::istringstream is(value);
+ for(int i = 0; i < size && (is >> v[i]); i++);
return v;
}
index 6ff107b9f0d0ffbc9253d2a7f6c4d1e5c5fdae0d..e158839baeb247e90b04f9f87f381138538cee27 100644 (file)
--- a/src/sp-fecolormatrix.cpp
+++ b/src/sp-fecolormatrix.cpp
(void)feColorMatrix;
NR::FilterColorMatrixType read_type;
- gdouble read_num;
/*DEAL WITH SETTING ATTRIBUTES HERE*/
switch(key) {
case SP_ATTR_TYPE:
index edcb1e9ca653ad501c4c0dc4f76ad75a9a921e9a..116d0ec898fba0e1045dbc4ffac1fdf53845df54 100644 (file)
_tree.remove_all_columns();
- SPFeColorMatrix* col = 0;
- SPFeConvolveMatrix* conv = 0;
+ std::vector<gdouble>* values = NULL;
if(SP_IS_FECOLORMATRIX(o))
- col = SP_FECOLORMATRIX(o);
+ values = &SP_FECOLORMATRIX(o)->values;
else if(SP_IS_FECONVOLVEMATRIX(o))
- conv = SP_FECONVOLVEMATRIX(o);
+ values = &SP_FECONVOLVEMATRIX(o)->kernelMatrix;
else
return;
for(int i = 0; i < cols; ++i) {
_tree.append_column_numeric_editable("", _columns.cols[i], "%.2f");
- dynamic_cast<Gtk::CellRendererText*>(_tree.get_column(i)->get_first_cell_renderer())->signal_edited().connect(
- sigc::mem_fun(*this, &MatrixAttr::rebind));
+ dynamic_cast<Gtk::CellRendererText*>(
+ _tree.get_column(i)->get_first_cell_renderer())->signal_edited().connect(
+ sigc::mem_fun(*this, &MatrixAttr::rebind));
}
for(int r = 0; r < rows; ++r) {
Gtk::TreeRow row = *(_model->append());
- for(int c = 0; c < cols; ++c, ++ndx) {
- if(col)
- row[_columns.cols[c]] = ndx < (int)col->values.size() ? col->values[ndx] : 0;
- else
- row[_columns.cols[c]] = ndx < (int)conv->kernelMatrix.size() ? conv->kernelMatrix[ndx] : 0;
- }
+ for(int c = 0; c < cols; ++c, ++ndx)
+ row[_columns.cols[c]] = ndx < (int)values->size() ? (*values)[ndx] : 0;
}
}
}
_angle(0, 0, 360, 0.1, 0.01, 1, SP_ATTR_VALUES),
_label(_("None"), Gtk::ALIGN_LEFT)
{
+ _matrix.signal_attr_changed().connect(signal_attr_changed().make_slot());
+ _saturation.signal_attr_changed().connect(signal_attr_changed().make_slot());
+ _angle.signal_attr_changed().connect(signal_attr_changed().make_slot());
+
_matrix.show();
_saturation.show();
_angle.show();
-
- _label.set_sensitive(false);
_label.show();
+ _label.set_sensitive(false);
set_shadow_type(Gtk::SHADOW_NONE);
}
_settings->add_combo(SP_ATTR_MODE, _("Mode"), BlendModeConverter);
_settings->type(NR_FILTER_COLORMATRIX);
- _settings->add_combo(SP_ATTR_TYPE, _("Type"), ColorMatrixTypeConverter);
- _settings->add_colormatrixvalues(_("Value(s)"));
+ ComboBoxEnum<FilterColorMatrixType>* colmat = _settings->add_combo(SP_ATTR_TYPE, _("Type"), ColorMatrixTypeConverter);
+ _color_matrix_values = _settings->add_colormatrixvalues(_("Value(s)"));
+ colmat->signal_attr_changed().connect(sigc::mem_fun(*this, &FilterEffectsDialog::update_color_matrix));
_settings->type(NR_FILTER_COMPOSITE);
_settings->add_combo(SP_ATTR_OPERATOR, _("Operator"), CompositeOperatorConverter);
_settings_box.hide_all();
_settings_box.show();
- _settings_box.set_sensitive(false);
- _empty_settings.show();
-
- if(prim) {
+ if(prim)
_settings->show_and_update(FPConverter.get_id_from_key(prim->repr->name()), prim);
- _settings_box.set_sensitive(true);
- _empty_settings.hide();
- }
+ else
+ _empty_settings.show();
update_settings_sensitivity();
}
_k4->set_sensitive(use_k);
}
+void FilterEffectsDialog::update_color_matrix()
+{
+ _color_matrix_values->set_from_attribute(_primitive_list.get_selected());
+}
+
} // namespace Dialog
} // namespace UI
} // namespace Inkscape
index 9e272fbabf86097661cf50b96cb21becd1fb999e..96fb481a0651da7dc08a4dedf55eac2338980800 100644 (file)
void set_attr(SPObject*, const SPAttributeEnum, const gchar* val);
void update_settings_view();
void update_settings_sensitivity();
+ void update_color_matrix();
// Filter effect selection
FilterModifier _filter_modifier;
Settings* _settings;
Glib::RefPtr<Gtk::SizeGroup> _sizegroup;
+ // Color Matrix
+ ColorMatrixValues* _color_matrix_values;
+
// Convolve Matrix
MatrixAttr* _convolve_matrix;
DualSpinButton* _convolve_order;