COIN-OR::LEMON - Graph Library

Changeset 108:bf355fd6563e in glemon-0.x for algobox.cc


Ignore:
Timestamp:
01/05/06 13:30:09 (14 years ago)
Author:
Hegyi Péter
Branch:
gui
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk/gui@2453
Message:

Several changes. \n If new map is added to mapstorage it emits signal with the name of the new map. This was important, because from now on not only tha mapwin should be updated. \n Furthermore algobox gets a pointer to mapstorage instead of only the mapnames from it. This is important because without it it would be complicated to pass all of the required maps to algobox.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • algobox.cc

    r106 r108  
    44enum {E_DEMO1, EDGE_INPUT_NUM}; // input IDs for edges;
    55
    6 AlgoBox::AlgoBox(std::vector<std::string> tabnames, std::vector<std::string> nodemapnames, std::vector<std::string> edgemapnames)
     6AlgoBox::AlgoBox(std::vector<std::string> tabnames)
    77{
    8   init(tabnames, nodemapnames, edgemapnames);
     8  init(tabnames);
    99}
    1010
    11 void AlgoBox::init(std::vector<std::string> tabnames, std::vector<std::string> nodemapnames, std::vector<std::string> edgemapnames)
     11void AlgoBox::init(std::vector<std::string> tabnames)
    1212{
    1313  set_spacing(5);
     
    1919
    2020  pack_start(tabcbt);
    21 
    2221  build_box();
    23 
    24   update_maplist(nodemapnames, edgemapnames);
    2522
    2623  show_all_children();
     
    5350  else if(actptr>0) //so there is item in the list
    5451    {
    55       cbt.set_active(0);
     52      //cbt.set_active(0);
    5653    }
    5754}
     
    6360}
    6461
    65 void AlgoBox::update_maplist( std::vector< std::string > nml, std::vector< std::string > eml )
     62void AlgoBox::update_maplist( void * ms)
    6663{
     64  mapstorage=(MapStorage *)ms;
     65  std::vector<std::string> nml;
     66  std::vector<std::string> eml;
     67  if(mapstorage!=NULL)
     68    {
     69      mapstorage->signal_node_map_ch().connect(sigc::mem_fun(*this, &AlgoBox::nodemaplist_changed));
     70      mapstorage->signal_edge_map_ch().connect(sigc::mem_fun(*this, &AlgoBox::edgemaplist_changed));
     71      nml=mapstorage->getNodeMapList();
     72      eml=mapstorage->getNodeMapList();
     73    }
    6774  for(int i=0;i<(int)nodemapcbts.size();i++)
    6875    {
     
    7279    {
    7380      update_cbt(eml, *(edgemapcbts[i]));
     81    }
     82}
     83
     84void AlgoBox::nodemaplist_changed(std::string newmap)
     85{
     86  for(int i=0;i<(int)nodemapcbts.size();i++)
     87    {
     88      (nodemapcbts[i])->append_text(newmap);
     89    }
     90}
     91
     92void AlgoBox::edgemaplist_changed(std::string newmap)
     93{
     94  for(int i=0;i<(int)edgemapcbts.size();i++)
     95    {
     96      (edgemapcbts[i])->append_text(newmap);
    7497    }
    7598}
     
    137160void AlgoBox::emit_tab_change()
    138161{
    139   signal_maplist_need.emit(tabcbt.get_active_text());
     162  std::string active_tab=tabcbt.get_active_text();
     163  if(active_tab!="")
     164    {
     165      signal_maplist_need.emit(active_tab);
     166    }
     167  else
     168    {
     169      std::vector<std::string> empty_vector;
     170      update_maplist(NULL);
     171    }
    140172}
Note: See TracChangeset for help on using the changeset viewer.