[Lemon-commits] [lemon_svn] hegyi: r2461 - hugo/trunk/gui
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:52:51 CET 2006
Author: hegyi
Date: Mon Jan 9 12:55:47 2006
New Revision: 2461
Modified:
hugo/trunk/gui/algobox.cc
hugo/trunk/gui/algobox.h
hugo/trunk/gui/kruskalbox.cc
Log:
Creation of algorithm dialog is even simpler by the usage of the newly created addMapSelector function.
Modified: hugo/trunk/gui/algobox.cc
==============================================================================
--- hugo/trunk/gui/algobox.cc (original)
+++ hugo/trunk/gui/algobox.cc Mon Jan 9 12:55:47 2006
@@ -117,39 +117,50 @@
pack_start(*label);
- nodemapcbts.resize(NODE_INPUT_NUM);
- for(int i=0;i<(int)nodemapcbts.size();i++)
+ for(int i=0;i<NODE_INPUT_NUM;i++)
{
- std::vector<std::string> empty_vector;
-
std::ostringstream o;
o << "NodeInput " << i+1 << ":";
- nodemapcbts[i]=new MapSelector(empty_vector,"",o.str(),false, false);
- nodemapcbts[i]->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &AlgoBox::emit_new_map_signal));
-
- pack_start(*(nodemapcbts[i]));
+ addMapSelector(o.str(), false);
}
pack_start(*(new Gtk::HSeparator()));
- edgemapcbts.resize(EDGE_INPUT_NUM);
- for(int i=0;i<(int)edgemapcbts.size();i++)
+ for(int i=0;i<EDGE_INPUT_NUM;i++)
{
- std::vector<std::string> empty_vector;
std::ostringstream o;
o << "EdgeInput " << i+1 << ":";
- edgemapcbts[i]=new MapSelector(empty_vector,"",o.str(),true, false);
- edgemapcbts[i]->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &AlgoBox::emit_new_map_signal));
-
- pack_start(*(edgemapcbts[i]));
+ addMapSelector(o.str(), true);
}
pack_start(*(new Gtk::HSeparator()));
}
+void AlgoBox::addMapSelector(std::string inputname, bool itisedge)
+{
+ std::vector<std::string> empty_vector;
+
+ MapSelector * msp=new MapSelector(empty_vector,"",inputname,itisedge, false);
+
+ if(itisedge)
+ {
+ edgemapcbts.resize(edgemapcbts.size()+1);
+ edgemapcbts[edgemapcbts.size()-1]=msp;
+ }
+ else
+ {
+ nodemapcbts.resize(nodemapcbts.size()+1);
+ nodemapcbts[nodemapcbts.size()-1]=msp;
+ }
+
+ msp->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &AlgoBox::emit_new_map_signal));
+
+ pack_start(*msp);
+}
+
sigc::signal<void, std::string> AlgoBox::signal_maplist_needed()
{
return signal_maplist_need;
Modified: hugo/trunk/gui/algobox.h
==============================================================================
--- hugo/trunk/gui/algobox.h (original)
+++ hugo/trunk/gui/algobox.h Mon Jan 9 12:55:47 2006
@@ -46,5 +46,7 @@
virtual void build_box();
virtual void emit_new_map_signal(bool);
+
+ void addMapSelector(std::string, bool);
};
#endif //ALGOBOX_H
Modified: hugo/trunk/gui/kruskalbox.cc
==============================================================================
--- hugo/trunk/gui/kruskalbox.cc (original)
+++ hugo/trunk/gui/kruskalbox.cc Mon Jan 9 12:55:47 2006
@@ -53,17 +53,8 @@
{
std::vector<std::string> empty_vector;
- edgemapcbts.resize(MAP_NUM);
-
- edgemapcbts[0]=new MapSelector(empty_vector,"","Edgecosts: ",true, false);
- edgemapcbts[0]->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &AlgoBox::emit_new_map_signal));
-
- pack_start(*(edgemapcbts[INPUT]));
-
- edgemapcbts[1]=new MapSelector(empty_vector,"","Edges of tree here: ",true, false);
- edgemapcbts[1]->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &AlgoBox::emit_new_map_signal));
-
- pack_start(*(edgemapcbts[OUTPUT]));
+ addMapSelector("Edgecosts: ", true);
+ addMapSelector("Edges of tree here: ", true);
resultlabel.set_text("Result: algorithm is not run yet.");
pack_start(resultlabel);
More information about the Lemon-commits
mailing list