Changeset 1884:9c061834b33b in lemon-0.x
- Timestamp:
- 01/06/06 17:07:08 (19 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2459
- Location:
- gui
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
gui/algobox.cc
r1879 r1884 74 74 for(int i=0;i<(int)nodemapcbts.size();i++) 75 75 { 76 update_cbt(nml, *(nodemapcbts[i])); 76 (nodemapcbts[i])->update_list(nml); 77 //update_cbt(nml, *(nodemapcbts[i])); 77 78 } 78 79 for(int i=0;i<(int)edgemapcbts.size();i++) 79 80 { 80 update_cbt(eml, *(edgemapcbts[i])); 81 (edgemapcbts[i])->update_list(eml); 82 //update_cbt(eml, *(edgemapcbts[i])); 81 83 } 82 84 } … … 107 109 pack_start(*(new Gtk::HSeparator())); 108 110 109 label=new Gtk::Label("Specific part for each algorithm.");111 Gtk::Label * label=new Gtk::Label("Specific part for each algorithm."); 110 112 111 113 pack_start(*label); … … 119 121 for(int i=0;i<(int)nodemapcbts.size();i++) 120 122 { 121 Gtk::HBox * hbox=new Gtk::HBox();123 std::vector<std::string> empty_vector; 122 124 123 125 std::ostringstream o; 124 126 o << "NodeInput " << i+1 << ":"; 125 label=new Gtk::Label(o.str());126 127 127 nodemapcbts[i]=new Gtk::ComboBoxText(); 128 nodemapcbts[i]=new MapSelector(empty_vector,"",o.str(),false, false); 129 nodemapcbts[i]->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &AlgoBox::emit_new_map_signal)); 128 130 129 hbox->pack_start(*label); 130 hbox->pack_start(*(nodemapcbts[i])); 131 pack_start(*hbox); 131 pack_start(*(nodemapcbts[i])); 132 132 } 133 133 … … 137 137 for(int i=0;i<(int)edgemapcbts.size();i++) 138 138 { 139 Gtk::HBox * hbox=new Gtk::HBox();139 std::vector<std::string> empty_vector; 140 140 141 141 std::ostringstream o; 142 142 o << "EdgeInput " << i+1 << ":"; 143 label=new Gtk::Label(o.str());144 143 145 edgemapcbts[i]=new Gtk::ComboBoxText(); 144 edgemapcbts[i]=new MapSelector(empty_vector,"",o.str(),true, false); 145 edgemapcbts[i]->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &AlgoBox::emit_new_map_signal)); 146 146 147 hbox->pack_start(*label); 148 hbox->pack_start(*(edgemapcbts[i])); 149 pack_start(*hbox); 147 pack_start(*(edgemapcbts[i])); 150 148 } 151 149 … … 171 169 } 172 170 } 171 172 void AlgoBox::emit_new_map_signal(bool itisedge) 173 { 174 signal_newmapwin_need.emit(tabcbt.get_active_text(), itisedge); 175 } -
gui/algobox.h
r1879 r1884 8 8 #include <all_include.h> 9 9 #include <mapstorage.h> 10 #include <mapselector.h> 10 11 #include <libgnomecanvasmm.h> 11 12 #include <libgnomecanvasmm/polygon.h> … … 14 15 { 15 16 sigc::signal<void, std::string> signal_maplist_need; 16 17 Gtk::ComboBoxText tabcbt; 17 sigc::signal<void, std::string, bool> signal_newmapwin_need; 18 18 19 19 protected: 20 Gtk:: Label * label;21 std::vector< Gtk::ComboBoxText*> nodemapcbts;22 std::vector< Gtk::ComboBoxText*> edgemapcbts;20 Gtk::ComboBoxText tabcbt; 21 std::vector<MapSelector *> nodemapcbts; 22 std::vector<MapSelector *> edgemapcbts; 23 23 24 24 MapStorage * mapstorage; … … 31 31 32 32 sigc::signal<void, std::string> signal_maplist_needed(); 33 sigc::signal<void, std::string, bool> signal_newmapwin_needed(){return signal_newmapwin_need;}; 33 34 void emit_tab_change(); 34 35 … … 44 45 45 46 virtual void build_box(); 47 48 virtual void emit_new_map_signal(bool); 46 49 }; 47 50 #endif //ALGOBOX_H -
gui/algowin.cc
r1879 r1884 44 44 } 45 45 ab->signal_maplist_needed().connect(sigc::mem_fun(*this, &AlgoWin::emit_tab_change)); 46 ab->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &AlgoWin::emit_new_map_signal)); 46 47 47 48 runbutton=new Gtk::Button("Run"); -
gui/algowin.h
r1879 r1884 26 26 sigc::signal<void, AlgoWin *> signal_closed; 27 27 sigc::signal<void, AlgoWin *, std::string> signal_maplist_need; 28 sigc::signal<void, std::string, bool> signal_newmapwin_need; 28 29 29 30 public: … … 32 33 sigc::signal<void, AlgoWin *> signal_closing(); 33 34 sigc::signal<void, AlgoWin *, std::string> signal_maplist_needed(); 35 sigc::signal<void, std::string, bool> signal_newmapwin_needed(){return signal_newmapwin_need;}; 34 36 35 37 void emit_tab_change(std::string); 38 void emit_new_map_signal(std::string tabname, bool itisedge){signal_newmapwin_need.emit(tabname, itisedge);}; 36 39 37 40 AlgoWin(int, std::vector<std::string>); -
gui/kruskalbox.cc
r1881 r1884 10 10 void KruskalBox::run() 11 11 { 12 Graph g=mapstorage->graph; 13 Graph::EdgeMap<double> * inputmap= 14 ((mapstorage->edgemap_storage)[(edgemapcbts[INPUT])->get_active_text()]); 15 Graph::EdgeMap<bool> outputmap(g); 16 double res=kruskal(g, *inputmap, outputmap); 12 if( 13 tabcbt.get_active_text()!="" && 14 (edgemapcbts[INPUT])->get_active_text()!="" && 15 (edgemapcbts[OUTPUT])->get_active_text()!="" 16 ) 17 { 17 18 18 for (EdgeIt i(g); i!=INVALID; ++i) 19 { 20 if(outputmap[i]) 21 { 22 (*((mapstorage->edgemap_storage)[(edgemapcbts[OUTPUT])-> 23 get_active_text()]))[i]=1; 24 } 25 else 26 { 27 (*((mapstorage->edgemap_storage)[(edgemapcbts[OUTPUT])-> 28 get_active_text()]))[i]=0; 29 } 30 } 19 Graph g=mapstorage->graph; 20 Graph::EdgeMap<double> * inputmap= 21 ((mapstorage->edgemap_storage)[(edgemapcbts[INPUT])->get_active_text()]); 22 Graph::EdgeMap<bool> outputmap(g); 23 double res=kruskal(g, *inputmap, outputmap); 31 24 32 std::ostringstream o; 33 o << "Result: " << res; 34 resultlabel.set_text(o.str()); 25 for (EdgeIt i(g); i!=INVALID; ++i) 26 { 27 if(outputmap[i]) 28 { 29 (*((mapstorage->edgemap_storage)[(edgemapcbts[OUTPUT])-> 30 get_active_text()]))[i]=1; 31 } 32 else 33 { 34 (*((mapstorage->edgemap_storage)[(edgemapcbts[OUTPUT])-> 35 get_active_text()]))[i]=0; 36 } 37 } 35 38 36 mapstorage->mapChanged(true, (edgemapcbts[OUTPUT])->get_active_text()); 37 // mapstorage->changeActiveMap(true, E_COLOR, 38 // (edgemapcbts[OUTPUT])->get_active_text()); 39 // mapstorage->changeActiveMap(true, E_TEXT, 40 // (edgemapcbts[INPUT])->get_active_text()); 39 std::ostringstream o; 40 o << "Result: " << res; 41 resultlabel.set_text(o.str()); 42 43 mapstorage->mapChanged(true, (edgemapcbts[OUTPUT])->get_active_text()); 44 // mapstorage->changeActiveMap(true, E_COLOR, 45 // (edgemapcbts[OUTPUT])->get_active_text()); 46 // mapstorage->changeActiveMap(true, E_TEXT, 47 // (edgemapcbts[INPUT])->get_active_text()); 41 48 49 } 42 50 } 43 51 44 52 void KruskalBox::build_box() 45 53 { 54 std::vector<std::string> empty_vector; 55 46 56 edgemapcbts.resize(MAP_NUM); 47 Gtk::HBox * hbox;48 57 49 hbox=new Gtk::HBox(); 58 edgemapcbts[0]=new MapSelector(empty_vector,"","Edgecosts: ",true, false); 59 edgemapcbts[0]->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &AlgoBox::emit_new_map_signal)); 50 60 51 label=new Gtk::Label("Edgecosts: ");61 pack_start(*(edgemapcbts[INPUT])); 52 62 53 edgemapcbts[0]=new Gtk::ComboBoxText(); 63 edgemapcbts[1]=new MapSelector(empty_vector,"","Edges of tree here: ",true, false); 64 edgemapcbts[1]->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &AlgoBox::emit_new_map_signal)); 54 65 55 hbox->pack_start(*label); 56 hbox->pack_start(*(edgemapcbts[INPUT])); 57 pack_start(*hbox); 58 59 hbox=new Gtk::HBox(); 60 61 label=new Gtk::Label("Edges of tree here: "); 62 63 edgemapcbts[1]=new Gtk::ComboBoxText(); 64 65 hbox->pack_start(*label); 66 hbox->pack_start(*(edgemapcbts[OUTPUT])); 67 pack_start(*hbox); 66 pack_start(*(edgemapcbts[OUTPUT])); 68 67 69 68 resultlabel.set_text("Result: algorithm is not run yet."); -
gui/main_win.cc
r1878 r1884 413 413 aw->signal_closing().connect(sigc::mem_fun(*this, &MainWin::deRegisterAlgoWin)); 414 414 aw->signal_maplist_needed().connect(sigc::mem_fun(*this, &MainWin::updateAlgoWinMaps)); 415 aw->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &MainWin::createNewMapWinTabString)); 415 416 aws.insert(aw); 416 417 aw->show(); … … 457 458 nmw->show(); 458 459 } 460 } 461 462 void MainWin::createNewMapWinTabString(std::string tabname, bool itisedge) 463 { 464 int i=0; 465 for(;((i<tabnames.size())&&(tabnames[i]!=tabname));i++) 466 { 467 } 468 createNewMapWinAfterSignal(tabs[i], itisedge); 459 469 } 460 470 -
gui/main_win.h
r1876 r1884 80 80 81 81 virtual void createNewMapWinAfterSignal(NoteBookTab *, bool); 82 virtual void createNewMapWinTabString(std::string, bool); 82 83 virtual void createNewMapWin(); 83 84 -
gui/map_win.cc
r1849 r1884 25 25 for(int i=0;i<EDGE_PROPERTY_NUM;i++) 26 26 { 27 e_combo_array[i]=new MapSelector(eml, mytab.getActiveEdgeMap(i), i, true);27 e_combo_array[i]=new MapSelector(eml, mytab.getActiveEdgeMap(i), edge_property_strings[i], true); 28 28 29 29 (*table).attach((*(e_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3); … … 45 45 for(int i=0;i<NODE_PROPERTY_NUM;i++) 46 46 { 47 n_combo_array[i]=new MapSelector(nml, mytab.getActiveNodeMap(i), i, false);47 n_combo_array[i]=new MapSelector(nml, mytab.getActiveNodeMap(i), node_property_strings[i], false); 48 48 49 49 (*table).attach((*(n_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3); -
gui/mapselector.cc
r1882 r1884 1 1 #include "mapselector.h" 2 2 3 MapSelector::MapSelector(std::vector<std::string> ml, std::string act, int identifier, bool edge):id(identifier),itisedge(edge),set_new_map(false)3 MapSelector::MapSelector(std::vector<std::string> ml, std::string act, std::string labeltext, bool edge, bool d):def(d),itisedge(edge),set_new_map(false) 4 4 { 5 5 update_list(ml); … … 23 23 ); 24 24 25 if(itisedge) 26 { 27 label=new Gtk::Label(edge_property_strings[id]); 28 } 29 else 30 { 31 label=new Gtk::Label(node_property_strings[id]); 32 } 25 label=new Gtk::Label(labeltext); 33 26 34 27 label->set_width_chars(longest_property_string_length); … … 72 65 cbt.append_text(*emsi); 73 66 } 74 cbt.prepend_text("Default values"); 67 if(def) 68 { 69 cbt.prepend_text("Default values"); 70 } 75 71 if(prev_act!=-1) 76 72 { -
gui/new_map_win.cc
r1879 r1884 115 115 else 116 116 { 117 char * def_val_ch=new char [(int)(ch2var[ polishform[i] ].length())]; 118 for(int j=0;j<(int)(ch2var[ polishform[i] ].length());j++) 119 { 120 def_val_ch[j]=ch2var[ polishform[i] ][j]; 121 } 122 polishstack.push(atof(def_val_ch)); 123 delete def_val_ch; 117 polishstack.push(atof(ch2var[ polishform[i] ].c_str())); 124 118 } 125 119 operation=false; … … 202 196 else 203 197 { 204 char * def_val_ch=new char [(int)(ch2var[ polishform[i] ].length())]; 205 for(int j=0;j<(int)(ch2var[ polishform[i] ].length());j++) 206 { 207 def_val_ch[j]=ch2var[ polishform[i] ][j]; 208 } 209 polishstack.push(atof(def_val_ch)); 210 delete def_val_ch; 198 polishstack.push(atof(ch2var[ polishform[i] ].c_str())); 211 199 } 212 200 operation=false;
Note: See TracChangeset
for help on using the changeset viewer.