Forgot the meat.
3 * This file is a part of LEMON, a generic C++ optimization library
5 * Copyright (C) 2003-2006
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
9 * Permission to use, modify and distribute this software is granted
10 * provided that this copyright notice appears in all copies. For
11 * precise terms see the accompanying LICENSE file.
13 * This software is provided "AS IS" with no warranty of any kind,
14 * express or implied, and with no claim as to its suitability for any
21 enum {N_DEMO1, N_DEMO2, NODE_INPUT_NUM}; // input IDs for nodes;
22 enum {E_DEMO1, EDGE_INPUT_NUM}; // input IDs for edges;
24 AlgoBox::AlgoBox(std::vector<std::string> tabnames)
29 void AlgoBox::init(std::vector<std::string> tabnames)
33 update_tablist(tabnames);
35 //if active tab is changed, the map names in cbt/s have to be updated
36 tabcbt.signal_changed().connect(sigc::mem_fun(*this, &AlgoBox::emit_tab_change));
44 void AlgoBox::update_cbt(std::vector< std::string > stringlist, Gtk::ComboBoxText & cbt)
46 std::string actname=cbt.get_active_text();
52 std::vector< std::string >::iterator emsi=stringlist.begin();
53 for(;emsi!=stringlist.end();emsi++)
60 cbt.append_text(*emsi);
66 cbt.set_active(prev_act);
68 else if(actptr>0) //so there is item in the list
74 void AlgoBox::update_tablist( std::vector< std::string > tl )
76 update_cbt(tl, tabcbt);
80 void AlgoBox::update_maplist(MapStorage * ms)
83 std::vector<std::string> nml;
84 std::vector<std::string> eml;
87 mapstorage->signal_node_map_ch().connect(sigc::mem_fun(*this, &AlgoBox::nodemaplist_changed));
88 mapstorage->signal_edge_map_ch().connect(sigc::mem_fun(*this, &AlgoBox::edgemaplist_changed));
89 nml=mapstorage->getNodeMapList();
90 eml=mapstorage->getEdgeMapList();
92 for(int i=0;i<(int)nodemapcbts.size();i++)
94 (nodemapcbts[i])->update_list(nml);
95 //update_cbt(nml, *(nodemapcbts[i]));
97 for(int i=0;i<(int)edgemapcbts.size();i++)
99 (edgemapcbts[i])->update_list(eml);
100 //update_cbt(eml, *(edgemapcbts[i]));
102 signal_maplist_updated.emit();
105 void AlgoBox::nodemaplist_changed(std::string newmap)
107 for(int i=0;i<(int)nodemapcbts.size();i++)
109 (nodemapcbts[i])->append_text(newmap);
113 void AlgoBox::edgemaplist_changed(std::string newmap)
115 for(int i=0;i<(int)edgemapcbts.size();i++)
117 (edgemapcbts[i])->append_text(newmap);
123 std::cout << "Start algorithm." << std::endl;
126 void AlgoBox::build_box()
128 pack_start(*(new Gtk::HSeparator()));
130 Gtk::Label * label=new Gtk::Label("Specific part for each algorithm.");
133 pack_start(*(new Gtk::HSeparator()));
135 label=new Gtk::Label("Maps in chosen tab:");
139 for(int i=0;i<NODE_INPUT_NUM;i++)
141 std::ostringstream o;
142 o << "NodeInput " << i+1 << ":";
144 addMapSelector(o.str(), false);
147 pack_start(*(new Gtk::HSeparator()));
149 for(int i=0;i<EDGE_INPUT_NUM;i++)
152 std::ostringstream o;
153 o << "EdgeInput " << i+1 << ":";
155 addMapSelector(o.str(), true);
158 pack_start(*(new Gtk::HSeparator()));
161 void AlgoBox::addMapSelector(std::string inputname, bool itisedge)
163 std::vector<std::string> empty_vector;
165 MapSelector * msp=new MapSelector(empty_vector,"",inputname,itisedge, false);
169 edgemapcbts.resize(edgemapcbts.size()+1);
170 edgemapcbts[edgemapcbts.size()-1]=msp;
174 nodemapcbts.resize(nodemapcbts.size()+1);
175 nodemapcbts[nodemapcbts.size()-1]=msp;
178 msp->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &AlgoBox::emit_new_map_signal));
183 sigc::signal<void, std::string> AlgoBox::signal_maplist_needed()
185 return signal_maplist_need;
188 void AlgoBox::emit_tab_change()
190 std::string active_tab=tabcbt.get_active_text();
193 signal_maplist_need.emit(active_tab);
197 std::vector<std::string> empty_vector;
198 update_maplist(NULL);
202 void AlgoBox::emit_new_map_signal(bool itisedge)
204 signal_newmapwin_need.emit(tabcbt.get_active_text(), itisedge);