Changeset 172:fc1e478697d3 in glemon-0.x
- Timestamp:
- 10/25/06 15:21:24 (18 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/glemon/trunk@3017
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
design_win.cc
r161 r172 10 10 } 11 11 12 DesignWin::DesignWin(const std::string& title, double attraction_v, double propulsation_v, int iterations_v )12 DesignWin::DesignWin(const std::string& title, double attraction_v, double propulsation_v, int iterations_v, NoteBookTab & mw):mytab(mw) 13 13 { 14 14 set_title(title); 15 16 mytab.signal_title_ch().connect(sigc::mem_fun(*this, &DesignWin::set_title)); 15 17 16 18 signal_key_press_event().connect(sigc::mem_fun(*this, &DesignWin::closeIfEscapeIsPressed)); … … 65 67 signal_iteration_ch.emit((int)iteration->get_value()); 66 68 } 69 70 void DesignWin::set_title(std::string tabname) 71 { 72 Gtk::Window::set_title("Design Setup - "+tabname); 73 } -
design_win.h
r161 r172 4 4 #define DESWIN_H 5 5 6 class DesignWin; 7 6 8 #include <all_include.h> 9 #include <nbtab.h> 7 10 #include <libgnomecanvasmm.h> 8 11 #include <libgnomecanvasmm/polygon.h> … … 11 14 { 12 15 private: 16 ///\ref NoteBookTab to that the \ref MapWin belongs to. 17 NoteBookTab & mytab; 18 13 19 Gtk::SpinButton * attraction; 14 20 Gtk::SpinButton * propulsation; … … 34 40 35 41 ///It builds the window. 36 DesignWin(const std::string&, double, double, int );42 DesignWin(const std::string&, double, double, int, NoteBookTab & mw); 37 43 38 44 sigc::signal<void, double> signal_attraction(){return signal_attraction_ch;}; … … 40 46 sigc::signal<void, int> signal_iteration(){return signal_iteration_ch;}; 41 47 sigc::signal<void> close_run(){return close_run_pr;}; 48 49 void set_title(std::string); 42 50 }; 43 51 #endif //DESWIN_H -
graph_displayer_canvas.cc
r168 r172 8 8 isbutton(0), active_item(NULL), target_item(NULL), nodemap_to_edit(""), 9 9 edgemap_to_edit(""), autoscale(true), zoomtrack(false), radius_size(20), edge_width(10), 10 iterations(20), attraction(0.05), propulsation(40000), was_redesigned(false), mytab(mainw)10 iterations(20), attraction(0.05), propulsation(40000), was_redesigned(false), is_drawn(false), mytab(mainw) 11 11 { 12 12 //base event handler is move tool … … 64 64 void GraphDisplayerCanvas::propertyUpdate(Node node, int prop) 65 65 { 66 //dummy=dummy;67 68 66 std::string mapname=mytab.getActiveNodeMap(prop); 69 67 70 if(mapname!="") 71 { 72 if( ( ((mytab.mapstorage).nodemap_storage).find(mapname) != ((mytab.mapstorage).nodemap_storage).end() ) ) 73 { 68 if(is_drawn) 69 { 70 if(mapname!="") 71 { 72 if( ( ((mytab.mapstorage).nodemap_storage).find(mapname) != ((mytab.mapstorage).nodemap_storage).end() ) ) 73 { 74 switch(prop) 75 { 76 case N_RADIUS: 77 changeNodeRadius(mapname, node); 78 break; 79 case N_COLOR: 80 changeNodeColor(mapname, node); 81 break; 82 case N_TEXT: 83 changeNodeText(mapname, node); 84 break; 85 default: 86 std::cerr<<"Error\n"; 87 } 88 } 89 } 90 else //mapname=="" 91 { 92 Node node=INVALID; 74 93 switch(prop) 75 94 { 76 95 case N_RADIUS: 77 changeNodeRadius(mapname,node);96 resetNodeRadius(node); 78 97 break; 79 98 case N_COLOR: 80 changeNodeColor(mapname,node);99 resetNodeColor(node); 81 100 break; 82 101 case N_TEXT: 83 changeNodeText(mapname,node);102 resetNodeText(node); 84 103 break; 85 104 default: … … 88 107 } 89 108 } 90 else //mapname==""91 {92 Node node=INVALID;93 switch(prop)94 {95 case N_RADIUS:96 resetNodeRadius(node);97 break;98 case N_COLOR:99 resetNodeColor(node);100 break;101 case N_TEXT:102 resetNodeText(node);103 break;104 default:105 std::cerr<<"Error\n";106 }107 }108 109 109 } 110 110 111 111 void GraphDisplayerCanvas::propertyUpdate(Edge edge, int prop) 112 112 { 113 //dummy=dummy;114 115 113 std::string mapname=mytab.getActiveEdgeMap(prop); 116 114 117 if(mapname!="") 118 { 119 if( ( ((mytab.mapstorage).edgemap_storage).find(mapname) != ((mytab.mapstorage).edgemap_storage).end() ) ) 115 if(is_drawn) 116 { 117 if(mapname!="") 118 { 119 if( ( ((mytab.mapstorage).edgemap_storage).find(mapname) != ((mytab.mapstorage).edgemap_storage).end() ) ) 120 { 121 switch(prop) 122 { 123 case E_WIDTH: 124 changeEdgeWidth(mapname, edge); 125 break; 126 case E_COLOR: 127 changeEdgeColor(mapname, edge); 128 break; 129 case E_TEXT: 130 changeEdgeText(mapname, edge); 131 break; 132 default: 133 std::cerr<<"Error\n"; 134 } 135 } 136 } 137 else //mapname=="" 120 138 { 121 139 switch(prop) 122 140 { 123 141 case E_WIDTH: 124 changeEdgeWidth(mapname,edge);142 resetEdgeWidth(edge); 125 143 break; 126 144 case E_COLOR: 127 changeEdgeColor(mapname,edge);145 resetEdgeColor(edge); 128 146 break; 129 147 case E_TEXT: 130 changeEdgeText(mapname,edge);148 resetEdgeText(edge); 131 149 break; 132 150 default: 133 151 std::cerr<<"Error\n"; 134 152 } 135 }136 }137 else //mapname==""138 {139 switch(prop)140 {141 case E_WIDTH:142 resetEdgeWidth(edge);143 break;144 case E_COLOR:145 resetEdgeColor(edge);146 break;147 case E_TEXT:148 resetEdgeText(edge);149 break;150 default:151 std::cerr<<"Error\n";152 153 } 153 154 } … … 208 209 } 209 210 211 is_drawn=true; 212 213 //upon drawing graph 214 //properties have to 215 //be set in as well 216 for(int i=0;i<NODE_PROPERTY_NUM;i++) 217 { 218 propertyUpdate(Node(INVALID), i); 219 } 220 221 for(int i=0;i<EDGE_PROPERTY_NUM;i++) 222 { 223 propertyUpdate(Edge(INVALID), i); 224 } 225 210 226 updateScrollRegion(); 211 227 } … … 228 244 delete edgetextmap[e]; 229 245 } 246 247 is_drawn=false; 230 248 } 231 249 -
graph_displayer_canvas.h
r166 r172 326 326 void set_iteration(int); 327 327 328 ///Show whether the graph is already drawn. 329 bool is_drawn; 330 328 331 private: 329 332 ///Deletes the given element. -
gui_reader.cc
r150 r172 27 27 } 28 28 mapstorage->ArrowPosReadOK(); 29 30 std::map<int, std::string> nm; 31 x("active_nodemaps", nm); 32 33 for(int i=0;i<NODE_PROPERTY_NUM;i++) 34 { 35 mapstorage->changeActiveMap(false, i, nm[i]); 36 } 37 38 std::map<int, std::string> em; 39 x("active_edgemaps", em); 40 for(int i=0;i<EDGE_PROPERTY_NUM;i++) 41 { 42 mapstorage->changeActiveMap(true, i, em[i]); 43 } 29 44 } 30 45 -
gui_writer.cc
r150 r172 20 20 } 21 21 x("arrow_pos", m); 22 23 std::map<int, std::string> nm; 24 for(int i=0;i<NODE_PROPERTY_NUM;i++) 25 { 26 nm[i]=mapstorage->active_nodemaps[i]; 27 } 28 x("active_nodemaps", nm); 29 30 std::map<int, std::string> em; 31 for(int i=0;i<EDGE_PROPERTY_NUM;i++) 32 { 33 em[i]=mapstorage->active_edgemaps[i]; 34 } 35 x("active_edgemaps", em); 22 36 } 23 37 -
map_win.cc
r146 r172 20 20 21 21 signal_key_press_event().connect(sigc::mem_fun(*this, &MapWin::closeIfEscapeIsPressed)); 22 23 mytab.signal_title_ch().connect(sigc::mem_fun(*this, &MapWin::set_title)); 22 24 23 25 e_combo_array=new MapSelector * [EDGE_PROPERTY_NUM]; … … 91 93 n_combo_array[i]->update_list(nml); 92 94 } 95 96 mytab.active_maps_needed(); 93 97 } 94 98 … … 117 121 return true; 118 122 } 123 124 void MapWin::changeEntry(bool isitedge, int prop, std::string mapname) 125 { 126 if(isitedge) 127 { 128 e_combo_array[prop]->set_active_text(mapname); 129 } 130 else 131 { 132 n_combo_array[prop]->set_active_text(mapname); 133 } 134 } 135 136 void MapWin::set_title(std::string tabname) 137 { 138 Gtk::Window::set_title("Map Setup - "+tabname); 139 } -
map_win.h
r123 r172 113 113 ///\param nml node map list 114 114 void update(std::vector<std::string> eml, std::vector<std::string> nml); 115 116 void changeEntry(bool, int, std::string); 117 118 void set_title(std::string); 115 119 }; 116 120 -
mapselector.cc
r122 r172 68 68 int prev_act=cbt.get_active_row_number(); 69 69 cbt.clear(); 70 cbt_content.clear(); 70 71 std::vector< std::string >::iterator emsi=ml.begin(); 71 72 for(;emsi!=ml.end();emsi++) 72 73 { 73 74 cbt.append_text(*emsi); 75 cbt_content.push_back(*emsi); 74 76 } 75 77 if(def) 76 78 { 77 79 cbt.prepend_text("Default values"); 80 cbt_content.push_back("Default values"); 78 81 } 79 82 if(prev_act!=-1) … … 117 120 void MapSelector::set_active_text(Glib::ustring text) 118 121 { 119 cbt.set_active_text(text); 122 if(text.compare("")) 123 { 124 cbt.set_active_text(text); 125 } 126 else 127 { 128 cbt.set_active_text("Default values"); 129 } 120 130 } 121 131 … … 123 133 { 124 134 cbt.append_text(text); 135 cbt_content.push_back(text); 136 125 137 if(set_new_map) 126 138 { -
mapselector.h
r123 r172 61 61 ///Names in it are selectable. 62 62 Gtk::ComboBoxText cbt; 63 64 std::vector<std::string> cbt_content; 63 65 64 66 ///New button. -
mapstorage.cc
r151 r172 53 53 int MapStorage::addNodeMap(const std::string & name, Graph::NodeMap<double> *nodemap, double default_value) 54 54 { 55 std::cout << default_value << std::endl;56 55 if( nodemap_storage.find(name) == nodemap_storage.end() ) 57 56 { … … 79 78 signal_prop.emit(itisedge, prop); 80 79 } 80 81 void MapStorage::broadcastActiveMaps() 82 { 83 for(int i=0;i<NODE_PROPERTY_NUM;i++) 84 { 85 signal_map_win.emit(false, i, active_nodemaps[i]); 86 } 87 88 for(int i=0;i<EDGE_PROPERTY_NUM;i++) 89 { 90 signal_map_win.emit(true, i, active_edgemaps[i]); 91 } 92 } 93 81 94 82 95 std::string MapStorage::getActiveEdgeMap(int prop) … … 441 454 file_name = ""; 442 455 modified = false; 456 457 arrow_pos_read_ok = false; 458 459 for(int i=0;i<NODE_PROPERTY_NUM;i++) 460 { 461 changeActiveMap(false, i, ""); 462 signal_map_win.emit(false, i, ""); 463 } 464 465 for(int i=0;i<EDGE_PROPERTY_NUM;i++) 466 { 467 changeActiveMap(true, i, ""); 468 signal_map_win.emit(true, i, ""); 469 } 443 470 } 444 471 -
mapstorage.h
r118 r172 86 86 sigc::signal<void, std::string> signal_edge_map; 87 87 88 /// Signal emitted, when entry in \ref MapWin should be changed. 89 sigc::signal<void, bool, int, std::string> signal_map_win; 90 88 91 public: 89 92 ///Constructor of MapStorage. … … 110 113 void changeActiveMap(bool itisedge , int prop , std::string mapname); 111 114 115 ///Emits signals that let change the active maps in \ref MapWin. 116 void broadcastActiveMaps(); 117 112 118 /// Returns the active edgemap shown by a visualization property. 113 119 … … 136 142 ///returns \ref signal_edge_map to be able to connect functions to it 137 143 sigc::signal<void, std::string> signal_edge_map_ch(){return signal_edge_map;}; 144 145 ///returns \ref signal_map_win to be able to connect functions to it 146 sigc::signal<void, bool, int, std::string> signal_map_win_ch(){return signal_map_win;}; 138 147 139 148 ///Adds given map to storage. -
nbtab.cc
r160 r172 203 203 { 204 204 mapwin=new MapWin("Map Setup - "+name, mapstorage.getEdgeMapList(), mapstorage.getNodeMapList(), *this); 205 mapst2mapwin=mapstorage.signal_map_win_ch().connect(sigc::mem_fun(*mapwin, &MapWin::changeEntry)); 205 206 mapwin->show(); 206 207 mapwinexists=true; … … 215 216 int iterations; 216 217 gd_canvas->get_design_data(attraction, propulsation, iterations); 217 designwin=new DesignWin("Design Setup - "+name, attraction, propulsation, iterations );218 designwin=new DesignWin("Design Setup - "+name, attraction, propulsation, iterations, *this); 218 219 219 220 designwin->signal_attraction().connect(sigc::mem_fun(*this, &NoteBookTab::attraction_ch)); … … 231 232 void NoteBookTab::closeMapWin() 232 233 { 234 mapst2mapwin.disconnect(); 233 235 mapwinexists=false; 234 236 delete mapwin; … … 279 281 } 280 282 283 void NoteBookTab::active_maps_needed() 284 { 285 mapstorage.broadcastActiveMaps(); 286 } -
nbtab.h
r160 r172 184 184 void getView(bool &, bool &, double&, double&); 185 185 186 ///Let the graph redesign, based on gravity and edge elasticity. 186 187 void reDesignGraph(); 187 188 189 ///Indicates that attraction factor is changed 188 190 void attraction_ch(double); 189 191 192 ///Indicates that propulsation factor is changed 190 193 void propulsation_ch(double); 191 194 195 ///Indicates that iteration number of redesign is changed 192 196 void iteration_ch(int); 197 198 ///\ref MapWin calls this function when it updates the maplist in comboboxes. 199 void active_maps_needed(); 200 201 private: 202 ///Signal connection from \ref MapStorage to \ref MapWin 203 204 ///If \ref MapWin is closed this connection has to be disconnected, 205 ///therefore we have to store it. 206 sigc::connection mapst2mapwin; 193 207 }; 194 208
Note: See TracChangeset
for help on using the changeset viewer.