From cb6970a357e8dc35ddfb05d55fbd59bfa0343fa0 Mon Sep 17 00:00:00 2001 From: buliabyak Date: Tue, 10 Feb 2009 22:57:06 +0000 Subject: [PATCH] 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 --- src/ui/widget/combo-enums.h | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) 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 -- 2.30.2