+2003-02-16 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
+
+ * FormPreferences.C (apply): make sure that rc.font_norm_type is
+ in sync with rc.font_norm
+
+2003-02-16 Rob Lahaye <lahaye@snu.ac.kr>
+
+ * RadioButtonGroup.[Ch]: polish radio button policy.
+
2003-02-15 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
* Menubar_pimpl.C (create_submenu): Some code moved to
}
-void RadioButtonGroup::set(size_type value)
+void RadioButtonGroup::set(size_type value) const
{
ButtonValueMap::const_iterator it =
find_if(map.begin(), map.end(),
lyx::equal_2nd_in_pair<ButtonValuePair>(value));
if (it != map.end()) {
- set(it->first);
+ fl_set_button(it->first, 1);
} else {
// We found nothing: report it and do nothing.
lyxerr << "BUG: Requested value in RadioButtonGroup "
}
-void RadioButtonGroup::set(FL_OBJECT * ob)
+void RadioButtonGroup::set(FL_OBJECT * ob) const
{
- fl_set_button(ob, 1);
+ // Object must be member of the radiobutton group.
+ bool isMember = false;
+ ButtonValueMap::const_iterator it = map.begin();
+ for (; it != map.end() && !isMember; ++it) {
+ isMember = it->first == ob;
+ }
+
+ if (isMember) {
+ fl_set_button(ob, 1);
+ } else {
+ // Object is not a member; report it and do nothing.
+ lyxerr << "BUG: Requested object is not a member of "
+ << "the RadioButtonGroup." << endl;
+ }
}
void init(FL_OBJECT * ob, size_type value);
// Set a single active button.
- void set(size_type value);
- void set(FL_OBJECT * ob);
+ void set(size_type value) const;
+ void set(FL_OBJECT * ob) const;
// Get the active button's value.
size_type get() const;
ButtonValueMap map;
};
-#endif
+#endif // RADIOBUTTONGROUP_H