gui/algobox.cc
changeset 1886 8b225c2935e7
parent 1884 9c061834b33b
     1.1 --- a/gui/algobox.cc	Fri Jan 06 23:16:51 2006 +0000
     1.2 +++ b/gui/algobox.cc	Mon Jan 09 11:55:47 2006 +0000
     1.3 @@ -117,39 +117,50 @@
     1.4        
     1.5    pack_start(*label);
     1.6  
     1.7 -  nodemapcbts.resize(NODE_INPUT_NUM);
     1.8 -  for(int i=0;i<(int)nodemapcbts.size();i++)
     1.9 +  for(int i=0;i<NODE_INPUT_NUM;i++)
    1.10      {
    1.11 -      std::vector<std::string> empty_vector;
    1.12 -
    1.13        std::ostringstream o;
    1.14        o << "NodeInput " << i+1 << ":";
    1.15  
    1.16 -      nodemapcbts[i]=new MapSelector(empty_vector,"",o.str(),false, false);
    1.17 -      nodemapcbts[i]->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &AlgoBox::emit_new_map_signal));
    1.18 -
    1.19 -      pack_start(*(nodemapcbts[i]));
    1.20 +      addMapSelector(o.str(), false);
    1.21      }
    1.22  
    1.23    pack_start(*(new Gtk::HSeparator()));
    1.24  
    1.25 -  edgemapcbts.resize(EDGE_INPUT_NUM);
    1.26 -  for(int i=0;i<(int)edgemapcbts.size();i++)
    1.27 +  for(int i=0;i<EDGE_INPUT_NUM;i++)
    1.28      {
    1.29 -      std::vector<std::string> empty_vector;
    1.30  
    1.31        std::ostringstream o;
    1.32        o << "EdgeInput " << i+1 << ":";
    1.33  
    1.34 -      edgemapcbts[i]=new MapSelector(empty_vector,"",o.str(),true, false);
    1.35 -      edgemapcbts[i]->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &AlgoBox::emit_new_map_signal));
    1.36 -
    1.37 -      pack_start(*(edgemapcbts[i]));
    1.38 +      addMapSelector(o.str(), true);
    1.39      }
    1.40  
    1.41    pack_start(*(new Gtk::HSeparator()));
    1.42  }
    1.43  
    1.44 +void AlgoBox::addMapSelector(std::string inputname, bool itisedge)
    1.45 +{
    1.46 +  std::vector<std::string> empty_vector;
    1.47 +
    1.48 +  MapSelector * msp=new MapSelector(empty_vector,"",inputname,itisedge, false);
    1.49 +
    1.50 +  if(itisedge)
    1.51 +    {
    1.52 +      edgemapcbts.resize(edgemapcbts.size()+1);
    1.53 +      edgemapcbts[edgemapcbts.size()-1]=msp;
    1.54 +    }
    1.55 +  else
    1.56 +    {
    1.57 +      nodemapcbts.resize(nodemapcbts.size()+1);
    1.58 +      nodemapcbts[nodemapcbts.size()-1]=msp;
    1.59 +    }
    1.60 +
    1.61 +  msp->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &AlgoBox::emit_new_map_signal));
    1.62 +
    1.63 +  pack_start(*msp);
    1.64 +}
    1.65 +
    1.66  sigc::signal<void, std::string> AlgoBox::signal_maplist_needed()
    1.67  {
    1.68    return signal_maplist_need;