]> git.lyx.org Git - features.git/blobdiff - src/frontends/xforms/RadioButtonGroup.C
InsetText draw-update fixes, implemented edit-table-menu, patch from Baruch.
[features.git] / src / frontends / xforms / RadioButtonGroup.C
index 1289c75cdd512aeb5317971ab0a5627427196453..c90b43e98a855520d859805aee1bf7dbe1cb0cb2 100644 (file)
 #include <algorithm>
 #include <iterator>
 using std::find_if;
+using std::bind2nd;
 using std::endl;
 
 void RadioButtonGroup::registerRadioButton(FL_OBJECT *button, int value)
 {
-#if 0
-    bvec.push_back(button);
-    vvec.push_back(value);
-#endif
     map.push_back( ButtonValuePair(button, value) );
 }
 
 
 void RadioButtonGroup::reset()
 {
-#if 0
-    bvec.clear();
-    vvec.clear();
-#endif
     map.clear(); 
 }
 
@@ -54,7 +47,7 @@ void RadioButtonGroup::reset()
     template <typename T>
     struct equal_to_second_in_pair {
         typedef bool                    result_type;
-        typedef T              first_argument_type;
+        typedef T      first_argument_type;
         typedef typename T::second_type second_argument_type;
 
         bool operator() (
@@ -67,37 +60,11 @@ void RadioButtonGroup::reset()
 
 void RadioButtonGroup::setButton(int value)
 {
-#if 0
-    ValueVector::iterator vit =
-        find_if(vvec.begin(), vvec.end(),
-            bind2nd(equal_to<int>(), value));
-    
-    if (vit == vvec.end()) {
-        lyxerr << "BUG: Requested value in RadioButtonGroup doesn't exists"
-            << endl;
-        return;
-    }
-
-    unsigned n = std::distance(vvec.begin(), vit);
-
-    fl_set_button(bvec[n], 1);
-#endif
-
-
     ButtonValueMap::const_iterator it = 
-#if 0
         find_if(map.begin(), map.end(),
                 bind2nd(equal_to_second_in_pair<ButtonValuePair>(),
                     value));
-#else
-        std::find_if(map.begin(), map.end(),
-                std::compose1(
-                    std::bind2nd(std::equal_to<int>(), value)
-                    ,
-                    std::select2nd<ButtonValuePair>()
-                )
-        );
-#endif
+
     // If we found nothing, report it and return
     if (it == map.end()) {
         lyxerr << "BUG: Requested value in RadioButtonGroup doesn't exists"
@@ -118,21 +85,6 @@ struct is_set_button {
 
 int  RadioButtonGroup::getButton()
 {
-#if 0
-    ButtonVector::const_iterator bit = bvec.begin();
-    ValueVector::const_iterator vit = vvec.begin();
-
-    while (bit != bvec.end()) {
-        if (fl_get_button(*bit))
-            return *vit;
-
-        bit++;
-        vit++;
-    }
-
-    return 0;
-#endif
-
     // Find the first button that is active
     ButtonValueMap::iterator it =
         find_if(map.begin(), map.end(),