COIN-OR::LEMON - Graph Library

Changeset 1886:8b225c2935e7 in lemon-0.x


Ignore:
Timestamp:
01/09/06 12:55:47 (14 years ago)
Author:
Hegyi Péter
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2461
Message:

Creation of algorithm dialog is even simpler by the usage of the newly created addMapSelector function.

Location:
gui
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • gui/algobox.cc

    r1884 r1886  
    118118  pack_start(*label);
    119119
    120   nodemapcbts.resize(NODE_INPUT_NUM);
    121   for(int i=0;i<(int)nodemapcbts.size();i++)
     120  for(int i=0;i<NODE_INPUT_NUM;i++)
    122121    {
    123       std::vector<std::string> empty_vector;
    124 
    125122      std::ostringstream o;
    126123      o << "NodeInput " << i+1 << ":";
    127124
    128       nodemapcbts[i]=new MapSelector(empty_vector,"",o.str(),false, false);
    129       nodemapcbts[i]->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &AlgoBox::emit_new_map_signal));
    130 
    131       pack_start(*(nodemapcbts[i]));
     125      addMapSelector(o.str(), false);
    132126    }
    133127
    134128  pack_start(*(new Gtk::HSeparator()));
    135129
    136   edgemapcbts.resize(EDGE_INPUT_NUM);
    137   for(int i=0;i<(int)edgemapcbts.size();i++)
     130  for(int i=0;i<EDGE_INPUT_NUM;i++)
    138131    {
    139       std::vector<std::string> empty_vector;
    140132
    141133      std::ostringstream o;
    142134      o << "EdgeInput " << i+1 << ":";
    143135
    144       edgemapcbts[i]=new MapSelector(empty_vector,"",o.str(),true, false);
    145       edgemapcbts[i]->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &AlgoBox::emit_new_map_signal));
    146 
    147       pack_start(*(edgemapcbts[i]));
     136      addMapSelector(o.str(), true);
    148137    }
    149138
    150139  pack_start(*(new Gtk::HSeparator()));
     140}
     141
     142void AlgoBox::addMapSelector(std::string inputname, bool itisedge)
     143{
     144  std::vector<std::string> empty_vector;
     145
     146  MapSelector * msp=new MapSelector(empty_vector,"",inputname,itisedge, false);
     147
     148  if(itisedge)
     149    {
     150      edgemapcbts.resize(edgemapcbts.size()+1);
     151      edgemapcbts[edgemapcbts.size()-1]=msp;
     152    }
     153  else
     154    {
     155      nodemapcbts.resize(nodemapcbts.size()+1);
     156      nodemapcbts[nodemapcbts.size()-1]=msp;
     157    }
     158
     159  msp->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &AlgoBox::emit_new_map_signal));
     160
     161  pack_start(*msp);
    151162}
    152163
  • gui/algobox.h

    r1884 r1886  
    4747
    4848  virtual void emit_new_map_signal(bool);
     49
     50  void addMapSelector(std::string, bool);
    4951};
    5052#endif //ALGOBOX_H
  • gui/kruskalbox.cc

    r1884 r1886  
    5454  std::vector<std::string> empty_vector;
    5555
    56   edgemapcbts.resize(MAP_NUM);
    57 
    58   edgemapcbts[0]=new MapSelector(empty_vector,"","Edgecosts: ",true, false);
    59   edgemapcbts[0]->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &AlgoBox::emit_new_map_signal));
    60 
    61   pack_start(*(edgemapcbts[INPUT]));
    62 
    63   edgemapcbts[1]=new MapSelector(empty_vector,"","Edges of tree here: ",true, false);
    64   edgemapcbts[1]->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &AlgoBox::emit_new_map_signal));
    65 
    66   pack_start(*(edgemapcbts[OUTPUT]));
     56  addMapSelector("Edgecosts: ", true);
     57  addMapSelector("Edges of tree here: ", true);
    6758
    6859  resultlabel.set_text("Result: algorithm is not run yet.");
Note: See TracChangeset for help on using the changeset viewer.