Changeset 1731:616bc933c2bc in lemon-0.x
- Timestamp:
- 10/20/05 17:50:23 (19 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2258
- Location:
- gui
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
gui/Makefile.am
r1659 r1731 27 27 new_map_win.h \ 28 28 xymap.h \ 29 icons/guipixbufs.h 29 icons/guipixbufs.h\ 30 mapselector.h\ 31 mapselector.cc 32 30 33 31 34 glemon_CXXFLAGS = $(GTK_CFLAGS) -
gui/all_include.h
r1651 r1731 33 33 extern std::vector <std::string> node_property_strings; 34 34 extern std::vector <double> node_property_defaults; 35 extern int longest_property_string_length; 35 36 #endif //MAIN_PART 36 37 -
gui/graph-displayer.cc
r1650 r1731 11 11 std::vector <std::string> node_property_strings; 12 12 std::vector <double> node_property_defaults; 13 13 int longest_property_string_length; 14 14 15 15 int main(int argc, char *argv[]) … … 38 38 node_property_defaults[N_TEXT]=0; 39 39 40 longest_property_string_length=0; 41 for(int i=0;i<EDGE_PROPERTY_NUM;i++) 42 { 43 int j=edge_property_strings[i].size(); 44 if(j>longest_property_string_length) 45 { 46 longest_property_string_length=j; 47 } 48 } 49 for(int i=0;i<NODE_PROPERTY_NUM;i++) 50 { 51 int j=node_property_strings[i].size(); 52 if(j>longest_property_string_length) 53 { 54 longest_property_string_length=j; 55 } 56 } 57 58 40 59 //initializing GUI 41 60 -
gui/graph_displayer_canvas-edge.cc
r1645 r1731 4 4 5 5 6 int GraphDisplayerCanvas:: changeEdgeWidth (std::string mapname,Edge edge)6 int GraphDisplayerCanvas::resetEdgeWidth (Edge edge) 7 7 { 8 8 Graph::EdgeMap<double> * actual_map; 9 9 double min, max; 10 10 11 if(mapname=="Default") 12 { 13 min=edge_property_defaults[E_WIDTH]; 14 max=edge_property_defaults[E_WIDTH]; 15 actual_map=new Graph::EdgeMap<double>(mapstorage.graph,edge_property_defaults[E_WIDTH]); 16 } 17 else 18 { 19 min=mapstorage.minOfEdgeMap(mapname); 20 max=mapstorage.maxOfEdgeMap(mapname); 21 actual_map=(mapstorage.edgemap_storage)[mapname]; 22 } 23 11 min=edge_property_defaults[E_WIDTH]; 12 max=edge_property_defaults[E_WIDTH]; 13 actual_map=new Graph::EdgeMap<double>(mapstorage.graph,edge_property_defaults[E_WIDTH]); 14 24 15 if(edge==INVALID) 25 16 { … … 48 39 } 49 40 return 0; 41 } 42 43 44 int GraphDisplayerCanvas::changeEdgeWidth (std::string mapname, Edge edge) 45 { 46 Graph::EdgeMap<double> * actual_map; 47 double min, max; 48 49 min=mapstorage.minOfEdgeMap(mapname); 50 max=mapstorage.maxOfEdgeMap(mapname); 51 actual_map=(mapstorage.edgemap_storage)[mapname]; 52 53 if(edge==INVALID) 54 { 55 for (EdgeIt i(mapstorage.graph); i!=INVALID; ++i) 56 { 57 double v=fabs((*actual_map)[i]); 58 int w; 59 if(min==max) 60 { 61 w=(int)(edge_property_defaults[E_WIDTH]); 62 } 63 else 64 { 65 w=(int)(MIN_EDGE_WIDTH+(v-min)/(max-min)*(MAX_EDGE_WIDTH-MIN_EDGE_WIDTH)); 66 } 67 edgesmap[i]->property_width_units().set_value(w); 68 } 69 } 70 else 71 { 72 int w=(int)(*actual_map)[edge]; 73 if(w>=0) 74 { 75 edgesmap[edge]->property_width_units().set_value(w); 76 } 77 } 78 return 0; 50 79 }; 51 80 … … 57 86 //green in RGB 58 87 Graph::EdgeMap<double> * actual_map; 59 if(mapname=="Default") 60 { 61 actual_map=new Graph::EdgeMap<double>(mapstorage.graph,edge_property_defaults[E_COLOR]); 62 } 63 else 64 { 65 actual_map=(mapstorage.edgemap_storage)[mapname]; 66 } 88 actual_map=(mapstorage.edgemap_storage)[mapname]; 67 89 68 90 double max, min; 69 91 70 if(mapname!="Default") 71 { 72 max=mapstorage.maxOfEdgeMap(mapname); 73 min=mapstorage.minOfEdgeMap(mapname); 74 } 75 else 76 { 77 max=edge_property_defaults[E_COLOR]; 78 min=edge_property_defaults[E_COLOR]; 79 } 92 max=mapstorage.maxOfEdgeMap(mapname); 93 min=mapstorage.minOfEdgeMap(mapname); 94 95 if(edge==INVALID) 96 { 97 for (EdgeIt i(mapstorage.graph); i!=INVALID; ++i) 98 { 99 double w=(*actual_map)[i]; 100 101 Gdk::Color color; 102 if(max!=min) 103 { 104 color.set_rgb_p (0, 100*(w-min)/(max-min), 0); 105 } 106 else 107 { 108 color.set_rgb_p (0, 100, 0); 109 } 110 edgesmap[i]->property_fill_color_gdk().set_value(color); 111 } 112 } 113 else 114 { 115 Gdk::Color color; 116 117 double w=(*actual_map)[edge]; 118 119 if(max!=min) 120 { 121 color.set_rgb_p (0, 100*(w-min)/(max-min), 0); 122 } 123 else 124 { 125 color.set_rgb_p (0, 100, 0); 126 } 127 128 edgesmap[edge]->property_fill_color_gdk().set_value(color); 129 } 130 return 0; 131 }; 132 133 int GraphDisplayerCanvas::resetEdgeColor (Edge edge) 134 { 135 136 //function maps the range of the maximum and 137 //the minimum of the nodemap to the range of 138 //green in RGB 139 Graph::EdgeMap<double> * actual_map; 140 actual_map=new Graph::EdgeMap<double>(mapstorage.graph,edge_property_defaults[E_COLOR]); 141 142 double max, min; 143 144 max=edge_property_defaults[E_COLOR]; 145 min=edge_property_defaults[E_COLOR]; 80 146 81 147 if(edge==INVALID) … … 128 194 for (EdgeIt i(mapstorage.graph); i!=INVALID; ++i) 129 195 { 130 if(mapname!="Default") 131 { 132 edgemap_to_edit=mapname; 133 double number=(*(mapstorage.edgemap_storage)[mapname])[i]; 134 135 std::ostringstream ostr; 136 ostr << number; 137 138 edgetextmap[i]->property_text().set_value(ostr.str()); 139 } 140 else 141 { 142 edgemap_to_edit=""; 143 edgetextmap[i]->property_text().set_value(""); 144 } 145 } 146 147 } 148 else 149 { 150 if(mapname!="Default") 151 { 196 edgemap_to_edit=mapname; 197 double number=(*(mapstorage.edgemap_storage)[mapname])[i]; 198 199 std::ostringstream ostr; 200 ostr << number; 201 202 edgetextmap[i]->property_text().set_value(ostr.str()); 203 } 204 205 } 206 else 207 { 152 208 double number=(*(mapstorage.edgemap_storage)[mapname])[edge]; 153 209 … … 156 212 157 213 edgetextmap[edge]->property_text().set_value(ostr.str()); 158 } 159 else 160 { 161 edgetextmap[edge]->property_text().set_value(""); 162 } 163 164 } 165 166 return 0; 167 168 }; 214 } 215 216 return 0; 217 218 }; 219 220 int GraphDisplayerCanvas::resetEdgeText (Edge edge) 221 { 222 //the number in the map will be written on the edge 223 //EXCEPT when the name of the map is Default, because 224 //in that case empty string will be written, because 225 //that is the deleter map 226 227 if(edge==INVALID) 228 { 229 for (EdgeIt i(mapstorage.graph); i!=INVALID; ++i) 230 { 231 edgemap_to_edit=""; 232 edgetextmap[i]->property_text().set_value(""); 233 } 234 235 } 236 else 237 { 238 edgetextmap[edge]->property_text().set_value(""); 239 } 240 241 return 0; 242 243 }; -
gui/graph_displayer_canvas-node.cc
r1643 r1731 8 8 Graph::NodeMap<double> * actual_map; 9 9 double min, max; 10 if(mapname=="Default") 11 { 12 min=node_property_defaults[N_RADIUS]; 13 max=node_property_defaults[N_RADIUS]; 14 actual_map=new Graph::NodeMap<double>(mapstorage.graph,node_property_defaults[N_RADIUS]); 15 } 16 else 17 { 18 min=mapstorage.minOfNodeMap(mapname); 19 max=mapstorage.maxOfNodeMap(mapname); 20 actual_map=(mapstorage.nodemap_storage)[mapname]; 21 } 10 min=mapstorage.minOfNodeMap(mapname); 11 max=mapstorage.maxOfNodeMap(mapname); 12 actual_map=(mapstorage.nodemap_storage)[mapname]; 22 13 23 14 if(node==INVALID) … … 70 61 }; 71 62 63 int GraphDisplayerCanvas::resetNodeRadius (Node node) 64 { 65 Graph::NodeMap<double> * actual_map; 66 double min, max; 67 min=node_property_defaults[N_RADIUS]; 68 max=node_property_defaults[N_RADIUS]; 69 actual_map=new Graph::NodeMap<double>(mapstorage.graph,node_property_defaults[N_RADIUS]); 70 71 if(node==INVALID) 72 { 73 for (NodeIt i(mapstorage.graph); i!=INVALID; ++i) 74 { 75 double v=fabs((*actual_map)[i]); 76 int w; 77 if(min==max) 78 { 79 w=(int)(node_property_defaults[N_RADIUS]); 80 } 81 else 82 { 83 w=(int)(MIN_NODE_RADIUS+(v-min)/(max-min)*(MAX_NODE_RADIUS-MIN_NODE_RADIUS)); 84 } 85 if(w>=0) 86 { 87 double x1, y1, x2, y2; 88 x1=nodesmap[i]->property_x1().get_value(); 89 x2=nodesmap[i]->property_x2().get_value(); 90 y1=nodesmap[i]->property_y1().get_value(); 91 y2=nodesmap[i]->property_y2().get_value(); 92 nodesmap[i]->property_x1().set_value((x1+x2)/2-w); 93 nodesmap[i]->property_x2().set_value((x1+x2)/2+w); 94 nodesmap[i]->property_y1().set_value((y1+y2)/2-w); 95 nodesmap[i]->property_y2().set_value((y1+y2)/2+w); 96 } 97 } 98 } 99 else 100 { 101 //I think only new nodes use this case 102 // int w=(int)(*actual_map)[node]; 103 int w=(int)(node_property_defaults[N_RADIUS]); 104 if(w>=0) 105 { 106 double x1, y1, x2, y2; 107 x1=nodesmap[node]->property_x1().get_value(); 108 x2=nodesmap[node]->property_x2().get_value(); 109 y1=nodesmap[node]->property_y1().get_value(); 110 y2=nodesmap[node]->property_y2().get_value(); 111 nodesmap[node]->property_x1().set_value((x1+x2)/2-w); 112 nodesmap[node]->property_x2().set_value((x1+x2)/2+w); 113 nodesmap[node]->property_y1().set_value((y1+y2)/2-w); 114 nodesmap[node]->property_y2().set_value((y1+y2)/2+w); 115 } 116 } 117 return 0; 118 }; 119 72 120 int GraphDisplayerCanvas::changeNodeColor (std::string mapname, Node node) 73 121 { … … 78 126 79 127 Graph::NodeMap<double> * actual_map; 80 if(mapname=="Default") 81 { 82 actual_map=new Graph::NodeMap<double>(mapstorage.graph,node_property_defaults[N_COLOR]); 83 } 84 else 85 { 86 actual_map=(mapstorage.nodemap_storage)[mapname]; 87 } 128 actual_map=(mapstorage.nodemap_storage)[mapname]; 88 129 89 130 double max, min; 90 131 91 if(mapname!="Default") 92 { 93 max=mapstorage.maxOfNodeMap(mapname); 94 min=mapstorage.minOfNodeMap(mapname); 95 } 96 else 97 { 98 max=node_property_defaults[N_COLOR]; 99 min=node_property_defaults[N_COLOR]; 100 } 101 132 max=mapstorage.maxOfNodeMap(mapname); 133 min=mapstorage.minOfNodeMap(mapname); 134 135 if(node==INVALID) 136 { 137 138 for (NodeIt i(mapstorage.graph); i!=INVALID; ++i) 139 { 140 Gdk::Color color; 141 142 double w=(*actual_map)[i]; 143 144 if(max!=min) 145 { 146 color.set_rgb_p (0, 0, 100*(w-min)/(max-min)); 147 } 148 else 149 { 150 color.set_rgb_p (0, 0, 100); 151 } 152 153 nodesmap[i]->property_fill_color_gdk().set_value(color); 154 } 155 } 156 else 157 { 158 Gdk::Color color; 159 160 double w=(*actual_map)[node]; 161 162 if(max!=min) 163 { 164 color.set_rgb_p (0, 0, 100*(w-min)/(max-min)); 165 } 166 else 167 { 168 color.set_rgb_p (0, 0, 100); 169 } 170 171 nodesmap[node]->property_fill_color_gdk().set_value(color); 172 } 173 return 0; 174 }; 175 176 int GraphDisplayerCanvas::resetNodeColor (Node node) 177 { 178 179 //function maps the range of the maximum and 180 //the minimum of the nodemap to the range of 181 //green in RGB 182 183 Graph::NodeMap<double> * actual_map; 184 actual_map=new Graph::NodeMap<double>(mapstorage.graph,node_property_defaults[N_COLOR]); 185 186 double max, min; 187 188 max=node_property_defaults[N_COLOR]; 189 min=node_property_defaults[N_COLOR]; 102 190 103 191 if(node==INVALID) … … 151 239 152 240 Graph::NodeMap<double> * actual_map=NULL; 153 if(mapname!="Default") 154 { 155 actual_map=(mapstorage.nodemap_storage)[mapname]; 156 } 157 158 if(node==INVALID) 159 { 160 for (NodeIt i(mapstorage.graph); i!=INVALID; ++i) 161 { 162 if(mapname!="Default") 163 { 164 nodemap_to_edit=mapname; 165 double number=(*actual_map)[i]; 166 167 std::ostringstream ostr; 168 ostr << number; 169 170 nodetextmap[i]->property_text().set_value(ostr.str()); 171 } 172 else 173 { 174 nodemap_to_edit=""; 175 nodetextmap[i]->property_text().set_value(""); 176 } 177 } 178 } 179 else 180 { 181 if(mapname!="Default") 182 { 183 double number=(*actual_map)[node]; 241 actual_map=(mapstorage.nodemap_storage)[mapname]; 242 243 if(node==INVALID) 244 { 245 for (NodeIt i(mapstorage.graph); i!=INVALID; ++i) 246 { 247 nodemap_to_edit=mapname; 248 double number=(*actual_map)[i]; 184 249 185 250 std::ostringstream ostr; 186 251 ostr << number; 187 252 188 nodetextmap[node]->property_text().set_value(ostr.str()); 189 } 190 else 191 { 192 nodetextmap[node]->property_text().set_value(""); 193 } 194 } 195 return 0; 196 }; 253 nodetextmap[i]->property_text().set_value(ostr.str()); 254 } 255 } 256 else 257 { 258 double number=(*actual_map)[node]; 259 260 std::ostringstream ostr; 261 ostr << number; 262 263 nodetextmap[node]->property_text().set_value(ostr.str()); 264 } 265 return 0; 266 }; 267 268 int GraphDisplayerCanvas::resetNodeText (Node node) 269 { 270 271 //the number in the map will be written on the node 272 //EXCEPT when the name of the map is Text, because 273 //in that case empty string will be written, because 274 //that is the deleter map 275 276 if(node==INVALID) 277 { 278 for (NodeIt i(mapstorage.graph); i!=INVALID; ++i) 279 { 280 nodemap_to_edit=""; 281 nodetextmap[i]->property_text().set_value(""); 282 } 283 } 284 else 285 { 286 nodetextmap[node]->property_text().set_value(""); 287 } 288 return 0; 289 }; -
gui/graph_displayer_canvas.h
r1648 r1731 25 25 ///\param mapname is the name of the map which contains the new values 26 26 int changeEdgeWidth (std::string mapname, Edge new_item=INVALID); 27 int resetEdgeWidth (Edge new_item=INVALID); 27 28 28 29 ///Changes the linecolor attribute according to the given map. 29 30 ///\param mapname is the name of the map which contains the new values 30 31 int changeEdgeColor (std::string mapname, Edge new_item=INVALID); 32 int resetEdgeColor (Edge new_item=INVALID); 31 33 32 34 ///Changes the text of line attribute according to the given map. 33 35 ///\param mapname is the name of the map which contains the new values 34 36 int changeEdgeText (std::string mapname, Edge new_item=INVALID); 37 int resetEdgeText (Edge new_item=INVALID); 35 38 36 39 ///Changes the linewidth attribute according to the given map. 37 40 ///\param mapname is the name of the map which contains the new values 38 41 int changeNodeRadius (std::string mapname, Node new_item=INVALID); 42 int resetNodeRadius (Node new_item=INVALID); 39 43 40 44 ///Changes the linecolor attribute according to the given map. 41 45 ///\param mapname is the name of the map which contains the new values 42 46 int changeNodeColor (std::string mapname, Node new_item=INVALID); 47 int resetNodeColor (Node new_item=INVALID); 43 48 44 49 ///Changes the text of line attribute according to the given map. 45 50 ///\param mapname is the name of the map which contains the new values 46 51 int changeNodeText (std::string mapname, Node new_item=INVALID); 52 int resetNodeText (Node new_item=INVALID); 47 53 48 54 ///Callback for 'ViewZoomIn' action. -
gui/map_win.cc
r1648 r1731 18 18 signal_key_press_event().connect(sigc::mem_fun(*this, &MapWin::closeIfEscapeIsPressed)); 19 19 20 e_combo_array=new Gtk::Combo[EDGE_PROPERTY_NUM];20 e_combo_array=new MapSelector * [EDGE_PROPERTY_NUM]; 21 21 22 table=new Gtk::Table(EDGE_PROPERTY_NUM, 2, false);22 table=new Gtk::Table(EDGE_PROPERTY_NUM, 1, false); 23 23 24 24 for(int i=0;i<EDGE_PROPERTY_NUM;i++) 25 25 { 26 //filling in combo box with choices 27 std::list<Glib::ustring> listStrings; 26 e_combo_array[i]=new MapSelector(gdc, ms, *this, i, true); 28 27 29 listStrings.push_back("Default"); 30 31 std::map< std::string,Graph::EdgeMap<double> * >::iterator emsi=ms.beginOfEdgeMaps(); 32 for(;emsi!=ms.endOfEdgeMaps();emsi++) 33 { 34 listStrings.push_back(emsi->first); 35 } 36 37 e_combo_array[i].set_popdown_strings(listStrings); 38 39 //Restrict it to these choices only: 40 e_combo_array[i].set_value_in_list(); 41 42 //binding signal to the actual entry 43 e_combo_array[i].get_entry()->signal_changed().connect 44 ( 45 sigc::bind 46 ( 47 sigc::mem_fun(*this, &MapWin::eComboChanged), 48 i 49 ) 50 ); 51 52 //placing actual entry in the right place 53 54 label=new Gtk::Label; 55 label->set_text(edge_property_strings[i]); 56 57 (*table).attach(*label,0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3); 58 (*table).attach(e_combo_array[i],1,2,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3); 59 60 28 (*table).attach((*(e_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3); 61 29 } 62 30 … … 67 35 vbox.pack_start(*(new Gtk::HSeparator)); 68 36 69 n_combo_array=new Gtk::Combo[NODE_PROPERTY_NUM];37 n_combo_array=new MapSelector * [NODE_PROPERTY_NUM]; 70 38 71 table=new Gtk::Table(NODE_PROPERTY_NUM, 2, false);39 table=new Gtk::Table(NODE_PROPERTY_NUM, 1, false); 72 40 73 41 for(int i=0;i<NODE_PROPERTY_NUM;i++) 74 42 { 75 //filling in combo box with choices 76 std::list<Glib::ustring> listStrings; 43 n_combo_array[i]=new MapSelector(gdc, ms, *this, i, false); 77 44 78 listStrings.push_back("Default"); 79 80 std::map< std::string,Graph::NodeMap<double> * >::iterator emsi=ms.beginOfNodeMaps(); 81 82 for(;emsi!=ms.endOfNodeMaps();emsi++) 83 { 84 if ((emsi->first != "coordinates_x") && (emsi->first != "coordinates_y")) 85 { 86 listStrings.push_back(emsi->first); 87 } 88 } 89 90 n_combo_array[i].set_popdown_strings(listStrings); 91 92 //Restrict it to these choices only: 93 n_combo_array[i].set_value_in_list(); 94 95 //binding signal to thew actual entry 96 n_combo_array[i].get_entry()->signal_changed().connect 97 ( 98 sigc::bind 99 ( 100 sigc::mem_fun(*this, &MapWin::nComboChanged), 101 i 102 ) 103 ); 104 105 //placing actual entry in the right place 106 107 label=new Gtk::Label; 108 label->set_text(node_property_strings[i]); 109 110 (*table).attach(*label,0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3); 111 (*table).attach(n_combo_array[i],1,2,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3); 112 113 45 (*table).attach((*(n_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3); 114 46 } 115 47 … … 128 60 for(int i=0;i<EDGE_PROPERTY_NUM;i++) 129 61 { 130 //filling in combo box with choices131 std::list<Glib::ustring> listStrings;62 e_combo_array[i]->update_list(); 63 } 132 64 133 listStrings.push_back("Default");134 135 std::map< std::string,Graph::EdgeMap<double> * >::iterator emsi=ms.beginOfEdgeMaps();136 for(;emsi!=ms.endOfEdgeMaps();emsi++)137 {138 listStrings.push_back(emsi->first);139 }140 141 e_combo_array[i].set_popdown_strings(listStrings);142 }143 65 for(int i=0;i<NODE_PROPERTY_NUM;i++) 144 66 { 145 //filling in combo box with choices 146 std::list<Glib::ustring> listStrings; 147 148 listStrings.push_back("Default"); 149 150 std::map< std::string,Graph::NodeMap<double> * >::iterator emsi=ms.beginOfNodeMaps(); 151 152 for(;emsi!=ms.endOfNodeMaps();emsi++) 153 { 154 if ((emsi->first != "coordinates_x") && (emsi->first != "coordinates_y")) 155 { 156 listStrings.push_back(emsi->first); 157 } 158 } 159 160 n_combo_array[i].set_popdown_strings(listStrings); 67 n_combo_array[i]->update_list(); 161 68 } 162 69 } 163 70 164 void MapWin::eComboChanged(int prop)165 {166 167 Gtk::Entry* entry = e_combo_array[prop].get_entry();168 169 if(entry)170 {171 Glib::ustring mapname = entry->get_text();172 if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.173 {174 if( ( (ms.edgemap_storage).find(mapname) != (ms.edgemap_storage).end() ) || (mapname=="Default") )175 {176 switch(prop)177 {178 case E_WIDTH:179 gdc.changeEdgeWidth(mapname);180 break;181 case E_COLOR:182 gdc.changeEdgeColor(mapname);183 break;184 case E_TEXT:185 gdc.changeEdgeText(mapname);186 break;187 default:188 std::cerr<<"Error\n";189 }190 }191 }192 }193 };194 195 void MapWin::nComboChanged(int prop)196 {197 198 Gtk::Entry* entry = n_combo_array[prop].get_entry();199 200 if(entry)201 {202 Glib::ustring mapname = entry->get_text();203 if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.204 {205 if( ( (ms.nodemap_storage).find(mapname) != (ms.nodemap_storage).end() ) || (mapname=="Default") )206 {207 switch(prop)208 {209 case N_RADIUS:210 gdc.changeNodeRadius(mapname);211 break;212 case N_COLOR:213 gdc.changeNodeColor(mapname);214 break;215 case N_TEXT:216 gdc.changeNodeText(mapname);217 break;218 default:219 std::cerr<<"Error\n";220 }221 }222 }223 }224 };225 71 226 72 void MapWin::updateNode(Node node) … … 228 74 for(int i=0;i<NODE_PROPERTY_NUM;i++) 229 75 { 230 Gtk::Entry* entry = n_combo_array[i].get_entry(); 231 232 if(entry) 233 { 234 Glib::ustring mapname = entry->get_text(); 235 if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty. 236 { 237 if( ( (ms.nodemap_storage).find(mapname) != (ms.nodemap_storage).end() ) || (mapname=="Default") ) 238 { 239 switch(i) 240 { 241 case N_RADIUS: 242 gdc.changeNodeRadius(mapname, node); 243 break; 244 case N_COLOR: 245 gdc.changeNodeColor(mapname, node); 246 break; 247 case N_TEXT: 248 gdc.changeNodeText(mapname, node); 249 break; 250 default: 251 std::cerr<<"Error\n"; 252 } 253 } 254 } 255 } 76 n_combo_array[i]->update(node); 256 77 } 257 78 } … … 261 82 for(int i=0;i<EDGE_PROPERTY_NUM;i++) 262 83 { 263 264 Gtk::Entry* entry = e_combo_array[i].get_entry(); 265 266 if(entry) 267 { 268 Glib::ustring mapname = entry->get_text(); 269 if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty. 270 { 271 272 if( ( (ms.edgemap_storage).find(mapname) != (ms.edgemap_storage).end() ) || (mapname=="Default") ) 273 { 274 switch(i) 275 { 276 case E_WIDTH: 277 gdc.changeEdgeWidth(mapname, edge); 278 break; 279 case E_COLOR: 280 gdc.changeEdgeColor(mapname, edge); 281 break; 282 case E_TEXT: 283 gdc.changeEdgeText(mapname, edge); 284 break; 285 default: 286 std::cerr<<"Error\n"; 287 } 288 } 289 } 290 } 84 e_combo_array[i]->update(edge); 291 85 } 292 86 } … … 297 91 { 298 92 //filling in combo box with choices 299 std::list<Glib::ustring> listStrings=e_combo_array[i].get_popdown_strings(); 300 listStrings.push_back(newmapname); 301 e_combo_array[i].set_popdown_strings(listStrings); 93 e_combo_array[i]->append_text((Glib::ustring)newmapname); 302 94 } 303 95 //setting text property for the new map 304 Gtk::Entry* entry = e_combo_array[E_TEXT].get_entry(); 305 entry->set_text((Glib::ustring)newmapname); 96 e_combo_array[N_TEXT]->set_active_text((Glib::ustring)newmapname); 306 97 } 307 98 … … 311 102 { 312 103 //filling in combo box with choices 313 std::list<Glib::ustring> listStrings=n_combo_array[i].get_popdown_strings(); 314 listStrings.push_back(newmapname); 315 n_combo_array[i].set_popdown_strings(listStrings); 104 e_combo_array[i]->append_text((Glib::ustring)newmapname); 316 105 } 317 106 //setting text property for the new map 318 Gtk::Entry* entry = n_combo_array[N_TEXT].get_entry(); 319 entry->set_text((Glib::ustring)newmapname); 107 n_combo_array[N_TEXT]->set_active_text((Glib::ustring)newmapname); 320 108 } -
gui/map_win.h
r1606 r1731 9 9 #include "graph_displayer_canvas.h" 10 10 #include "mapstorage.h" 11 #include "mapselector.h" 11 12 #include <libgnomecanvasmm.h> 12 13 #include <libgnomecanvasmm/polygon.h> … … 29 30 Gtk::Table * table; 30 31 31 Gtk::Combo * e_combo_array,* n_combo_array;32 MapSelector ** e_combo_array, ** n_combo_array; 32 33 33 34 Gtk::Label * label; … … 38 39 ///Constructor of MapWin creates the widgets shown in MapWin. 39 40 MapWin(const std::string& title, MapStorage &, GraphDisplayerCanvas &); 40 41 ///If a radiobutton is clicked, this function determines42 ///which button was that and after that calls the43 ///appropriate function of the \ref GraphDisplayerCanvas44 ///to change the visible values of that attribute.45 virtual void eComboChanged(int);46 ///If a radiobutton is clicked, this function determines47 ///which button was that and after that calls the48 ///appropriate function of the \ref GraphDisplayerCanvas49 ///to change the visible values of that attribute.50 virtual void nComboChanged(int);51 41 52 42 ///This function is created to set the appropriate maps on the newly created node
Note: See TracChangeset
for help on using the changeset viewer.