diff -r b1be10a9a2b6 -r bf355fd6563e algobox.cc --- a/algobox.cc Thu Jan 05 01:54:24 2006 +0000 +++ b/algobox.cc Thu Jan 05 12:30:09 2006 +0000 @@ -3,12 +3,12 @@ enum {N_DEMO1, N_DEMO2, NODE_INPUT_NUM}; // input IDs for nodes; enum {E_DEMO1, EDGE_INPUT_NUM}; // input IDs for edges; -AlgoBox::AlgoBox(std::vector tabnames, std::vector nodemapnames, std::vector edgemapnames) +AlgoBox::AlgoBox(std::vector tabnames) { - init(tabnames, nodemapnames, edgemapnames); + init(tabnames); } -void AlgoBox::init(std::vector tabnames, std::vector nodemapnames, std::vector edgemapnames) +void AlgoBox::init(std::vector tabnames) { set_spacing(5); @@ -18,11 +18,8 @@ tabcbt.signal_changed().connect(sigc::mem_fun(*this, &AlgoBox::emit_tab_change)); pack_start(tabcbt); - build_box(); - update_maplist(nodemapnames, edgemapnames); - show_all_children(); }; @@ -52,7 +49,7 @@ } else if(actptr>0) //so there is item in the list { - cbt.set_active(0); + //cbt.set_active(0); } } @@ -62,8 +59,18 @@ emit_tab_change(); } -void AlgoBox::update_maplist( std::vector< std::string > nml, std::vector< std::string > eml ) +void AlgoBox::update_maplist( void * ms) { + mapstorage=(MapStorage *)ms; + std::vector nml; + std::vector eml; + if(mapstorage!=NULL) + { + mapstorage->signal_node_map_ch().connect(sigc::mem_fun(*this, &AlgoBox::nodemaplist_changed)); + mapstorage->signal_edge_map_ch().connect(sigc::mem_fun(*this, &AlgoBox::edgemaplist_changed)); + nml=mapstorage->getNodeMapList(); + eml=mapstorage->getNodeMapList(); + } for(int i=0;i<(int)nodemapcbts.size();i++) { update_cbt(nml, *(nodemapcbts[i])); @@ -74,6 +81,22 @@ } } +void AlgoBox::nodemaplist_changed(std::string newmap) +{ + for(int i=0;i<(int)nodemapcbts.size();i++) + { + (nodemapcbts[i])->append_text(newmap); + } +} + +void AlgoBox::edgemaplist_changed(std::string newmap) +{ + for(int i=0;i<(int)edgemapcbts.size();i++) + { + (edgemapcbts[i])->append_text(newmap); + } +} + void AlgoBox::run() { std::cout << "Start algorithm." << std::endl; @@ -136,5 +159,14 @@ void AlgoBox::emit_tab_change() { - signal_maplist_need.emit(tabcbt.get_active_text()); + std::string active_tab=tabcbt.get_active_text(); + if(active_tab!="") + { + signal_maplist_need.emit(active_tab); + } + else + { + std::vector empty_vector; + update_maplist(NULL); + } }