From: buliabyak Date: Tue, 10 Feb 2009 22:57:06 +0000 (+0000) Subject: it was a very stupid idea to sort all combos without asking - this broke the blend... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=cb6970a357e8dc35ddfb05d55fbd59bfa0343fa0;p=inkscape.git it was a very stupid idea to sort all combos without asking - this broke the blend modes list in fill/stroke which relied on the set order of its enum --- diff --git a/src/ui/widget/combo-enums.h b/src/ui/widget/combo-enums.h index 11777e0b5..4f70c9d28 100644 --- a/src/ui/widget/combo-enums.h +++ b/src/ui/widget/combo-enums.h @@ -33,10 +33,14 @@ private: return an.compare(bn); } + bool _sort; + public: - ComboBoxEnum(E default_value, const Util::EnumDataConverter& c, const SPAttributeEnum a = SP_ATTR_INVALID) + ComboBoxEnum(E default_value, const Util::EnumDataConverter& c, const SPAttributeEnum a = SP_ATTR_INVALID, bool sort = true) : AttrWidget(a, (unsigned int)default_value), setProgrammatically(false), _converter(c) { + _sort = sort; + signal_changed().connect(signal_attr_changed().make_slot()); _model = Gtk::ListStore::create(_columns); @@ -54,13 +58,17 @@ public: set_active_by_id(default_value); // Sort the list - _model->set_default_sort_func(sigc::mem_fun(*this, &ComboBoxEnum::on_sort_compare)); - _model->set_sort_column(_columns.label, Gtk::SORT_ASCENDING); + if (sort) { + _model->set_default_sort_func(sigc::mem_fun(*this, &ComboBoxEnum::on_sort_compare)); + _model->set_sort_column(_columns.label, Gtk::SORT_ASCENDING); + } } - ComboBoxEnum(const Util::EnumDataConverter& c, const SPAttributeEnum a = SP_ATTR_INVALID) + ComboBoxEnum(const Util::EnumDataConverter& c, const SPAttributeEnum a = SP_ATTR_INVALID, bool sort = true) : AttrWidget(a, (unsigned int) 0), setProgrammatically(false), _converter(c) { + _sort = sort; + signal_changed().connect(signal_attr_changed().make_slot()); _model = Gtk::ListStore::create(_columns); @@ -78,8 +86,10 @@ public: set_active(0); // Sort the list - _model->set_default_sort_func(sigc::mem_fun(*this, &ComboBoxEnum::on_sort_compare)); - _model->set_sort_column(_columns.label, Gtk::SORT_ASCENDING); + if (_sort) { + _model->set_default_sort_func(sigc::mem_fun(*this, &ComboBoxEnum::on_sort_compare)); + _model->set_sort_column(_columns.label, Gtk::SORT_ASCENDING); + } } virtual Glib::ustring get_as_attribute() const