gui/algobox.cc
changeset 1878 409a31271efd
parent 1876 5ad84ad1b68f
child 1879 01d41844ef46
     1.1 --- a/gui/algobox.cc	Thu Jan 05 01:54:24 2006 +0000
     1.2 +++ b/gui/algobox.cc	Thu Jan 05 12:30:09 2006 +0000
     1.3 @@ -3,12 +3,12 @@
     1.4  enum {N_DEMO1, N_DEMO2, NODE_INPUT_NUM}; // input IDs for nodes;
     1.5  enum {E_DEMO1, EDGE_INPUT_NUM}; // input IDs for edges;
     1.6  
     1.7 -AlgoBox::AlgoBox(std::vector<std::string> tabnames, std::vector<std::string> nodemapnames, std::vector<std::string> edgemapnames)
     1.8 +AlgoBox::AlgoBox(std::vector<std::string> tabnames)
     1.9  {
    1.10 -  init(tabnames, nodemapnames, edgemapnames);
    1.11 +  init(tabnames);
    1.12  }
    1.13  
    1.14 -void AlgoBox::init(std::vector<std::string> tabnames, std::vector<std::string> nodemapnames, std::vector<std::string> edgemapnames)
    1.15 +void AlgoBox::init(std::vector<std::string> tabnames)
    1.16  {
    1.17    set_spacing(5);
    1.18  
    1.19 @@ -18,11 +18,8 @@
    1.20    tabcbt.signal_changed().connect(sigc::mem_fun(*this, &AlgoBox::emit_tab_change));
    1.21  
    1.22    pack_start(tabcbt);
    1.23 -
    1.24    build_box();
    1.25  
    1.26 -  update_maplist(nodemapnames, edgemapnames);
    1.27 -
    1.28    show_all_children();
    1.29  };
    1.30  
    1.31 @@ -52,7 +49,7 @@
    1.32      }
    1.33    else if(actptr>0) //so there is item in the list
    1.34      {
    1.35 -      cbt.set_active(0);
    1.36 +      //cbt.set_active(0);
    1.37      }
    1.38  }
    1.39  
    1.40 @@ -62,8 +59,18 @@
    1.41    emit_tab_change();
    1.42  }
    1.43  
    1.44 -void AlgoBox::update_maplist( std::vector< std::string > nml, std::vector< std::string > eml )
    1.45 +void AlgoBox::update_maplist( void * ms)
    1.46  {
    1.47 +  mapstorage=(MapStorage *)ms;
    1.48 +  std::vector<std::string> nml;
    1.49 +  std::vector<std::string> eml;
    1.50 +  if(mapstorage!=NULL)
    1.51 +    {
    1.52 +      mapstorage->signal_node_map_ch().connect(sigc::mem_fun(*this, &AlgoBox::nodemaplist_changed));
    1.53 +      mapstorage->signal_edge_map_ch().connect(sigc::mem_fun(*this, &AlgoBox::edgemaplist_changed));
    1.54 +      nml=mapstorage->getNodeMapList();
    1.55 +      eml=mapstorage->getNodeMapList();
    1.56 +    }
    1.57    for(int i=0;i<(int)nodemapcbts.size();i++)
    1.58      {
    1.59        update_cbt(nml, *(nodemapcbts[i]));
    1.60 @@ -74,6 +81,22 @@
    1.61      }
    1.62  }
    1.63  
    1.64 +void AlgoBox::nodemaplist_changed(std::string newmap)
    1.65 +{
    1.66 +  for(int i=0;i<(int)nodemapcbts.size();i++)
    1.67 +    {
    1.68 +      (nodemapcbts[i])->append_text(newmap);
    1.69 +    }
    1.70 +}
    1.71 +
    1.72 +void AlgoBox::edgemaplist_changed(std::string newmap)
    1.73 +{
    1.74 +  for(int i=0;i<(int)edgemapcbts.size();i++)
    1.75 +    {
    1.76 +      (edgemapcbts[i])->append_text(newmap);
    1.77 +    }
    1.78 +}
    1.79 +
    1.80  void AlgoBox::run()
    1.81  {
    1.82    std::cout << "Start algorithm." << std::endl;
    1.83 @@ -136,5 +159,14 @@
    1.84  
    1.85  void AlgoBox::emit_tab_change()
    1.86  {
    1.87 -  signal_maplist_need.emit(tabcbt.get_active_text());
    1.88 +  std::string active_tab=tabcbt.get_active_text();
    1.89 +  if(active_tab!="")
    1.90 +    {
    1.91 +      signal_maplist_need.emit(active_tab);
    1.92 +    }
    1.93 +  else
    1.94 +    {
    1.95 +      std::vector<std::string> empty_vector;
    1.96 +      update_maplist(NULL);
    1.97 +    }
    1.98  }