Structure of GUI is now more clear-cut than before.
1.1 --- a/gui/graph_displayer_canvas-edge.cc Tue Nov 29 08:43:50 2005 +0000
1.2 +++ b/gui/graph_displayer_canvas-edge.cc Tue Nov 29 19:31:58 2005 +0000
1.3 @@ -8,11 +8,11 @@
1.4
1.5 min=edge_property_defaults[E_WIDTH];
1.6 max=edge_property_defaults[E_WIDTH];
1.7 - Graph::EdgeMap<double> actual_map(mapstorage.graph,edge_property_defaults[E_WIDTH]);
1.8 + Graph::EdgeMap<double> actual_map((mainwin.mapstorage).graph,edge_property_defaults[E_WIDTH]);
1.9
1.10 if(edge==INVALID)
1.11 {
1.12 - for (EdgeIt i(mapstorage.graph); i!=INVALID; ++i)
1.13 + for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
1.14 {
1.15 double v=fabs(actual_map[i]);
1.16 int w;
1.17 @@ -44,13 +44,13 @@
1.18 Graph::EdgeMap<double> * actual_map;
1.19 double min, max;
1.20
1.21 - min=mapstorage.minOfEdgeMap(mapname);
1.22 - max=mapstorage.maxOfEdgeMap(mapname);
1.23 - actual_map=(mapstorage.edgemap_storage)[mapname];
1.24 + min=(mainwin.mapstorage).minOfEdgeMap(mapname);
1.25 + max=(mainwin.mapstorage).maxOfEdgeMap(mapname);
1.26 + actual_map=((mainwin.mapstorage).edgemap_storage)[mapname];
1.27
1.28 if(edge==INVALID)
1.29 {
1.30 - for (EdgeIt i(mapstorage.graph); i!=INVALID; ++i)
1.31 + for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
1.32 {
1.33 double v=fabs((*actual_map)[i]);
1.34 int w;
1.35 @@ -83,16 +83,16 @@
1.36 //the minimum of the nodemap to the range of
1.37 //green in RGB
1.38 Graph::EdgeMap<double> * actual_map;
1.39 - actual_map=(mapstorage.edgemap_storage)[mapname];
1.40 + actual_map=((mainwin.mapstorage).edgemap_storage)[mapname];
1.41
1.42 double max, min;
1.43
1.44 - max=mapstorage.maxOfEdgeMap(mapname);
1.45 - min=mapstorage.minOfEdgeMap(mapname);
1.46 + max=(mainwin.mapstorage).maxOfEdgeMap(mapname);
1.47 + min=(mainwin.mapstorage).minOfEdgeMap(mapname);
1.48
1.49 if(edge==INVALID)
1.50 {
1.51 - for (EdgeIt i(mapstorage.graph); i!=INVALID; ++i)
1.52 + for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
1.53 {
1.54 double w=(*actual_map)[i];
1.55
1.56 @@ -134,7 +134,7 @@
1.57 //function maps the range of the maximum and
1.58 //the minimum of the nodemap to the range of
1.59 //green in RGB
1.60 - Graph::EdgeMap<double> actual_map(mapstorage.graph,edge_property_defaults[E_COLOR]);
1.61 + Graph::EdgeMap<double> actual_map((mainwin.mapstorage).graph,edge_property_defaults[E_COLOR]);
1.62
1.63 double max, min;
1.64
1.65 @@ -143,7 +143,7 @@
1.66
1.67 if(edge==INVALID)
1.68 {
1.69 - for (EdgeIt i(mapstorage.graph); i!=INVALID; ++i)
1.70 + for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
1.71 {
1.72 double w=actual_map[i];
1.73
1.74 @@ -188,10 +188,10 @@
1.75
1.76 if(edge==INVALID)
1.77 {
1.78 - for (EdgeIt i(mapstorage.graph); i!=INVALID; ++i)
1.79 + for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
1.80 {
1.81 edgemap_to_edit=mapname;
1.82 - double number=(*(mapstorage.edgemap_storage)[mapname])[i];
1.83 + double number=(*((mainwin.mapstorage).edgemap_storage)[mapname])[i];
1.84
1.85 std::ostringstream ostr;
1.86 ostr << number;
1.87 @@ -202,7 +202,7 @@
1.88 }
1.89 else
1.90 {
1.91 - double number=(*(mapstorage.edgemap_storage)[mapname])[edge];
1.92 + double number=(*((mainwin.mapstorage).edgemap_storage)[mapname])[edge];
1.93
1.94 std::ostringstream ostr;
1.95 ostr << number;
1.96 @@ -223,7 +223,7 @@
1.97
1.98 if(edge==INVALID)
1.99 {
1.100 - for (EdgeIt i(mapstorage.graph); i!=INVALID; ++i)
1.101 + for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
1.102 {
1.103 edgemap_to_edit="";
1.104 edgetextmap[i]->property_text().set_value("");
2.1 --- a/gui/graph_displayer_canvas-event.cc Tue Nov 29 08:43:50 2005 +0000
2.2 +++ b/gui/graph_displayer_canvas-event.cc Tue Nov 29 19:31:58 2005 +0000
2.3 @@ -94,7 +94,7 @@
2.4
2.5 active_item=(get_item_at(clicked_x, clicked_y));
2.6 active_node=INVALID;
2.7 - for (NodeIt i(mapstorage.graph); i!=INVALID; ++i)
2.8 + for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
2.9 {
2.10 if(nodesmap[i]==active_item)
2.11 {
2.12 @@ -125,7 +125,7 @@
2.13 //we only have to do sg. if the mouse button is pressed AND the click was on a node that was found in the set of nodes
2.14 if(active_node!=INVALID)
2.15 {
2.16 - mapstorage.modified = true;
2.17 + (mainwin.mapstorage).modified = true;
2.18
2.19 //new coordinates will be the old values,
2.20 //because the item will be moved to the
2.21 @@ -144,52 +144,52 @@
2.22 nodetextmap[active_node]->move(dx, dy);
2.23
2.24 // the new coordinates of the centre of the node
2.25 - double coord_x = new_x - (clicked_x - mapstorage.coords[active_node].x);
2.26 - double coord_y = new_y - (clicked_y - mapstorage.coords[active_node].y);
2.27 + double coord_x = new_x - (clicked_x - (mainwin.mapstorage).coords[active_node].x);
2.28 + double coord_y = new_y - (clicked_y - (mainwin.mapstorage).coords[active_node].y);
2.29
2.30 clicked_x=new_x;
2.31 clicked_y=new_y;
2.32
2.33 // write back the new coordinates to the coords map
2.34 - mapstorage.coords.set(active_node, xy<double>(coord_x, coord_y));
2.35 + (mainwin.mapstorage).coords.set(active_node, xy<double>(coord_x, coord_y));
2.36
2.37 // reposition the coordinates text
2.38 std::ostringstream ostr;
2.39 ostr << "(" <<
2.40 - mapstorage.coords[active_node].x << ", " <<
2.41 - mapstorage.coords[active_node].y << ")";
2.42 + (mainwin.mapstorage).coords[active_node].x << ", " <<
2.43 + (mainwin.mapstorage).coords[active_node].y << ")";
2.44 double radius =
2.45 (nodesmap[active_node]->property_x2().get_value() -
2.46 nodesmap[active_node]->property_x1().get_value()) / 2.0;
2.47 if (coord_text)
2.48 {
2.49 coord_text->property_text().set_value(ostr.str());
2.50 - coord_text->property_x().set_value(mapstorage.coords[active_node].x +
2.51 + coord_text->property_x().set_value((mainwin.mapstorage).coords[active_node].x +
2.52 radius);
2.53 - coord_text->property_y().set_value(mapstorage.coords[active_node].y -
2.54 + coord_text->property_y().set_value((mainwin.mapstorage).coords[active_node].y -
2.55 radius);
2.56 }
2.57 else
2.58 {
2.59 coord_text = new Gnome::Canvas::Text(
2.60 displayed_graph,
2.61 - mapstorage.coords[active_node].x + radius,
2.62 - mapstorage.coords[active_node].y - radius,
2.63 + (mainwin.mapstorage).coords[active_node].x + radius,
2.64 + (mainwin.mapstorage).coords[active_node].y - radius,
2.65 ostr.str());
2.66 coord_text->property_fill_color().set_value("black");
2.67 coord_text->property_anchor().set_value(Gtk::ANCHOR_SOUTH_WEST);
2.68 }
2.69
2.70 //all the edges connected to the moved point has to be redrawn
2.71 - for(OutEdgeIt ei(mapstorage.graph,active_node);ei!=INVALID;++ei)
2.72 + for(OutEdgeIt ei((mainwin.mapstorage).graph,active_node);ei!=INVALID;++ei)
2.73 {
2.74 Gnome::Canvas::Points coos;
2.75 double x1, x2, y1, y2;
2.76
2.77 - nodesmap[mapstorage.graph.source(ei)]->get_bounds(x1, y1, x2, y2);
2.78 + nodesmap[(mainwin.mapstorage).graph.source(ei)]->get_bounds(x1, y1, x2, y2);
2.79 coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
2.80
2.81 - nodesmap[mapstorage.graph.target(ei)]->get_bounds(x1, y1, x2, y2);
2.82 + nodesmap[(mainwin.mapstorage).graph.target(ei)]->get_bounds(x1, y1, x2, y2);
2.83 coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
2.84
2.85 if(isbutton==3)
2.86 @@ -208,15 +208,15 @@
2.87 edgetextmap[ei]->property_y().set_value(text_pos.y);
2.88 }
2.89
2.90 - for(InEdgeIt ei(mapstorage.graph,active_node);ei!=INVALID;++ei)
2.91 + for(InEdgeIt ei((mainwin.mapstorage).graph,active_node);ei!=INVALID;++ei)
2.92 {
2.93 Gnome::Canvas::Points coos;
2.94 double x1, x2, y1, y2;
2.95
2.96 - nodesmap[mapstorage.graph.source(ei)]->get_bounds(x1, y1, x2, y2);
2.97 + nodesmap[(mainwin.mapstorage).graph.source(ei)]->get_bounds(x1, y1, x2, y2);
2.98 coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
2.99
2.100 - nodesmap[mapstorage.graph.target(ei)]->get_bounds(x1, y1, x2, y2);
2.101 + nodesmap[(mainwin.mapstorage).graph.target(ei)]->get_bounds(x1, y1, x2, y2);
2.102 coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
2.103
2.104 if(isbutton==3)
2.105 @@ -256,33 +256,33 @@
2.106 }
2.107
2.108 case GDK_BUTTON_RELEASE:
2.109 - mapstorage.modified = true;
2.110 + (mainwin.mapstorage).modified = true;
2.111
2.112 isbutton=1;
2.113
2.114 - active_node=mapstorage.graph.addNode();
2.115 + active_node=(mainwin.mapstorage).graph.addNode();
2.116
2.117 //initiating values corresponding to new node in maps
2.118
2.119 window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
2.120
2.121 // update coordinates
2.122 - mapstorage.coords.set(active_node, xy<double>(clicked_x, clicked_y));
2.123 + (mainwin.mapstorage).coords.set(active_node, xy<double>(clicked_x, clicked_y));
2.124
2.125 // update all other maps
2.126 for (std::map<std::string, Graph::NodeMap<double>*>::const_iterator it =
2.127 - mapstorage.nodemap_storage.begin(); it !=
2.128 - mapstorage.nodemap_storage.end(); ++it)
2.129 + (mainwin.mapstorage).nodemap_storage.begin(); it !=
2.130 + (mainwin.mapstorage).nodemap_storage.end(); ++it)
2.131 {
2.132 if ((it->first != "coordinates_x") &&
2.133 (it->first != "coordinates_y"))
2.134 {
2.135 (*(it->second))[active_node] =
2.136 - mapstorage.nodemap_default[it->first];
2.137 + (mainwin.mapstorage).nodemap_default[it->first];
2.138 }
2.139 }
2.140 // increment the id map's default value
2.141 - mapstorage.nodemap_default["id"] += 1.0;
2.142 + (mainwin.mapstorage).nodemap_default["id"] += 1.0;
2.143
2.144 nodesmap[active_node]=new Gnome::Canvas::Ellipse(displayed_graph,
2.145 clicked_x-20, clicked_y-20, clicked_x+20, clicked_y+20);
2.146 @@ -301,7 +301,8 @@
2.147 nodetextmap[active_node]->property_fill_color().set_value("darkblue");
2.148 nodetextmap[active_node]->raise_to_top();
2.149
2.150 - mapwin.updateNode(active_node);
2.151 +// mapwin.updateNode(active_node);
2.152 + propertyUpdate(active_node);
2.153
2.154 isbutton=0;
2.155 target_item=NULL;
2.156 @@ -331,7 +332,7 @@
2.157
2.158 active_item=(get_item_at(clicked_x, clicked_y));
2.159 active_node=INVALID;
2.160 - for (NodeIt i(mapstorage.graph); i!=INVALID; ++i)
2.161 + for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
2.162 {
2.163 if(nodesmap[i]==active_item)
2.164 {
2.165 @@ -360,7 +361,7 @@
2.166 window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
2.167 target_item=(get_item_at(clicked_x, clicked_y));
2.168 Node target_node=INVALID;
2.169 - for (NodeIt i(mapstorage.graph); i!=INVALID; ++i)
2.170 + for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
2.171 {
2.172 if(nodesmap[i]==target_item)
2.173 {
2.174 @@ -372,26 +373,26 @@
2.175 {
2.176 if(target_node!=active_node)
2.177 {
2.178 - mapstorage.modified = true;
2.179 + (mainwin.mapstorage).modified = true;
2.180
2.181 *(nodesmap[target_node]) <<
2.182 Gnome::Canvas::Properties::fill_color("red");
2.183
2.184 //creating new edge
2.185 - active_edge=mapstorage.graph.addEdge(active_node,
2.186 + active_edge=(mainwin.mapstorage).graph.addEdge(active_node,
2.187 target_node);
2.188
2.189 // update maps
2.190 for (std::map<std::string,
2.191 Graph::EdgeMap<double>*>::const_iterator it =
2.192 - mapstorage.edgemap_storage.begin(); it !=
2.193 - mapstorage.edgemap_storage.end(); ++it)
2.194 + (mainwin.mapstorage).edgemap_storage.begin(); it !=
2.195 + (mainwin.mapstorage).edgemap_storage.end(); ++it)
2.196 {
2.197 (*(it->second))[active_edge] =
2.198 - mapstorage.edgemap_default[it->first];
2.199 + (mainwin.mapstorage).edgemap_default[it->first];
2.200 }
2.201 // increment the id map's default value
2.202 - mapstorage.edgemap_default["id"] += 1.0;
2.203 + (mainwin.mapstorage).edgemap_default["id"] += 1.0;
2.204
2.205 //calculating coordinates of new edge
2.206 Gnome::Canvas::Points coos;
2.207 @@ -423,7 +424,8 @@
2.208 edgetextmap[active_edge]->raise_to_top();
2.209
2.210 //updating its properties
2.211 - mapwin.updateEdge(active_edge);
2.212 +// mapwin.updateEdge(active_edge);
2.213 + propertyUpdate(active_edge);
2.214 }
2.215 else
2.216 {
2.217 @@ -478,7 +480,7 @@
2.218 active_node=INVALID;
2.219 active_edge=INVALID;
2.220 //was it a node?
2.221 - for (NodeIt i(mapstorage.graph); i!=INVALID; ++i)
2.222 + for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
2.223 {
2.224 if(nodesmap[i]==active_item)
2.225 {
2.226 @@ -488,7 +490,7 @@
2.227 //or was it an edge?
2.228 if(active_node==INVALID)
2.229 {
2.230 - for (EdgeIt i(mapstorage.graph); i!=INVALID; ++i)
2.231 + for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
2.232 {
2.233 if(edgesmap[i]==active_item)
2.234 {
2.235 @@ -514,16 +516,16 @@
2.236 //a node was found
2.237 if(active_node!=INVALID)
2.238 {
2.239 - mapstorage.modified = true;
2.240 + (mainwin.mapstorage).modified = true;
2.241
2.242 std::set<Graph::Edge> edges_to_delete;
2.243
2.244 - for(OutEdgeIt e(mapstorage.graph,active_node);e!=INVALID;++e)
2.245 + for(OutEdgeIt e((mainwin.mapstorage).graph,active_node);e!=INVALID;++e)
2.246 {
2.247 edges_to_delete.insert(e);
2.248 }
2.249
2.250 - for(InEdgeIt e(mapstorage.graph,active_node);e!=INVALID;++e)
2.251 + for(InEdgeIt e((mainwin.mapstorage).graph,active_node);e!=INVALID;++e)
2.252 {
2.253 edges_to_delete.insert(e);
2.254 }
2.255 @@ -587,7 +589,7 @@
2.256 active_item=(get_item_at(clicked_x, clicked_y));
2.257
2.258 //find the activated item between texts
2.259 - for (EdgeIt i(mapstorage.graph); i!=INVALID; ++i)
2.260 + for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
2.261 {
2.262 //at the same time only one can be active
2.263 if(edgetextmap[i]==active_item)
2.264 @@ -599,7 +601,7 @@
2.265 //if it was not between texts, search for it between edges
2.266 if(clicked_edge==INVALID)
2.267 {
2.268 - for (EdgeIt i(mapstorage.graph); i!=INVALID; ++i)
2.269 + for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
2.270 {
2.271 //at the same time only one can be active
2.272 if((edgesmap[i]==active_item)||(edgetextmap[i]==active_item))
2.273 @@ -622,7 +624,7 @@
2.274 active_edge=clicked_edge;
2.275
2.276 //create a dialog
2.277 - Gtk::Dialog dialog("Edit value", *parentwin, true);
2.278 + Gtk::Dialog dialog("Edit value", mainwin, true);
2.279 dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
2.280 dialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_ACCEPT);
2.281 Gtk::VBox* vbox = dialog.get_vbox();
2.282 @@ -639,14 +641,15 @@
2.283 break;
2.284 case Gtk::RESPONSE_ACCEPT:
2.285 double new_value = spin.get_value();
2.286 - (*mapstorage.edgemap_storage[edgemap_to_edit])[active_edge] =
2.287 + (*(mainwin.mapstorage).edgemap_storage[edgemap_to_edit])[active_edge] =
2.288 new_value;
2.289 std::ostringstream ostr;
2.290 ostr << new_value;
2.291 edgetextmap[active_edge]->property_text().set_value(
2.292 ostr.str());
2.293 //mapwin.updateEdge(active_edge);
2.294 - mapwin.updateEdge(Edge(INVALID));
2.295 +// mapwin.updateEdge(Edge(INVALID));
2.296 + propertyUpdate(Edge(INVALID));
2.297 }
2.298 }
2.299 }
2.300 @@ -674,7 +677,7 @@
2.301 active_item=(get_item_at(clicked_x, clicked_y));
2.302
2.303 //find the activated item between texts
2.304 - for (NodeIt i(mapstorage.graph); i!=INVALID; ++i)
2.305 + for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
2.306 {
2.307 //at the same time only one can be active
2.308 if(nodetextmap[i]==active_item)
2.309 @@ -686,7 +689,7 @@
2.310 //if there was not, search for it between nodes
2.311 if(clicked_node==INVALID)
2.312 {
2.313 - for (NodeIt i(mapstorage.graph); i!=INVALID; ++i)
2.314 + for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
2.315 {
2.316 //at the same time only one can be active
2.317 if(nodesmap[i]==active_item)
2.318 @@ -709,7 +712,7 @@
2.319 active_node=clicked_node;
2.320
2.321 //create a dialog
2.322 - Gtk::Dialog dialog("Edit value", *parentwin, true);
2.323 + Gtk::Dialog dialog("Edit value", mainwin, true);
2.324 dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
2.325 dialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_ACCEPT);
2.326 Gtk::VBox* vbox = dialog.get_vbox();
2.327 @@ -726,14 +729,15 @@
2.328 break;
2.329 case Gtk::RESPONSE_ACCEPT:
2.330 double new_value = spin.get_value();
2.331 - (*mapstorage.nodemap_storage[nodemap_to_edit])[active_node] =
2.332 + (*(mainwin.mapstorage).nodemap_storage[nodemap_to_edit])[active_node] =
2.333 new_value;
2.334 std::ostringstream ostr;
2.335 ostr << new_value;
2.336 nodetextmap[active_node]->property_text().set_value(
2.337 ostr.str());
2.338 //mapwin.updateNode(active_node);
2.339 - mapwin.updateNode(Node(INVALID));
2.340 +// mapwin.updateNode(Node(INVALID));
2.341 + propertyUpdate(Node(INVALID));
2.342 }
2.343 }
2.344 }
2.345 @@ -750,14 +754,14 @@
2.346 {
2.347 delete(nodetextmap[node_to_delete]);
2.348 delete(nodesmap[node_to_delete]);
2.349 - mapstorage.graph.erase(node_to_delete);
2.350 + (mainwin.mapstorage).graph.erase(node_to_delete);
2.351 }
2.352
2.353 void GraphDisplayerCanvas::deleteItem(Edge edge_to_delete)
2.354 {
2.355 delete(edgetextmap[edge_to_delete]);
2.356 delete(edgesmap[edge_to_delete]);
2.357 - mapstorage.graph.erase(edge_to_delete);
2.358 + (mainwin.mapstorage).graph.erase(edge_to_delete);
2.359 }
2.360
2.361 void GraphDisplayerCanvas::textReposition(xy<double> new_place)
2.362 @@ -777,7 +781,7 @@
2.363 }
2.364 else
2.365 {
2.366 - for (EdgeIt i(mapstorage.graph); i!=INVALID; ++i)
2.367 + for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
2.368 {
2.369 if(edgesmap[i]==active_bre)
2.370 {
2.371 @@ -803,18 +807,18 @@
2.372 int GraphDisplayerCanvas::addNewEdgeMap(double default_value, std::string mapname)
2.373 {
2.374 //create the new map
2.375 - Graph::EdgeMap<double> * emptr=new Graph::EdgeMap<double> (mapstorage.graph, default_value);
2.376 + Graph::EdgeMap<double> * emptr=new Graph::EdgeMap<double> ((mainwin.mapstorage).graph, default_value);
2.377
2.378 //if addition was not successful addEdgeMap returns one.
2.379 //cause can be that there is already a map named like the new one
2.380 - if(mapstorage.addEdgeMap(mapname,emptr, default_value))
2.381 + if((mainwin.mapstorage).addEdgeMap(mapname,emptr, default_value))
2.382 {
2.383 return 1;
2.384 }
2.385
2.386
2.387 //add it to the list of the displayable maps
2.388 - mapwin.registerNewEdgeMap(mapname);
2.389 + mainwin.registerNewEdgeMap(mapname);
2.390
2.391 //display it
2.392 changeEdgeText(mapname);
2.393 @@ -825,17 +829,17 @@
2.394 int GraphDisplayerCanvas::addNewNodeMap(double default_value, std::string mapname)
2.395 {
2.396 //create the new map
2.397 - Graph::NodeMap<double> * emptr=new Graph::NodeMap<double> (mapstorage.graph,default_value);
2.398 + Graph::NodeMap<double> * emptr=new Graph::NodeMap<double> ((mainwin.mapstorage).graph,default_value);
2.399
2.400 //if addition was not successful addNodeMap returns one.
2.401 //cause can be that there is already a map named like the new one
2.402 - if(mapstorage.addNodeMap(mapname,emptr, default_value))
2.403 + if((mainwin.mapstorage).addNodeMap(mapname,emptr, default_value))
2.404 {
2.405 return 1;
2.406 }
2.407
2.408 //add it to the list of the displayable maps
2.409 - mapwin.registerNewNodeMap(mapname);
2.410 + mainwin.registerNewNodeMap(mapname);
2.411
2.412 //display it
2.413 changeNodeText(mapname);
3.1 --- a/gui/graph_displayer_canvas-node.cc Tue Nov 29 08:43:50 2005 +0000
3.2 +++ b/gui/graph_displayer_canvas-node.cc Tue Nov 29 19:31:58 2005 +0000
3.3 @@ -6,13 +6,13 @@
3.4 {
3.5 Graph::NodeMap<double> * actual_map;
3.6 double min, max;
3.7 - min=mapstorage.minOfNodeMap(mapname);
3.8 - max=mapstorage.maxOfNodeMap(mapname);
3.9 - actual_map=(mapstorage.nodemap_storage)[mapname];
3.10 + min=(mainwin.mapstorage).minOfNodeMap(mapname);
3.11 + max=(mainwin.mapstorage).maxOfNodeMap(mapname);
3.12 + actual_map=((mainwin.mapstorage).nodemap_storage)[mapname];
3.13
3.14 if(node==INVALID)
3.15 {
3.16 - for (NodeIt i(mapstorage.graph); i!=INVALID; ++i)
3.17 + for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
3.18 {
3.19 double v=fabs((*actual_map)[i]);
3.20 int w;
3.21 @@ -64,11 +64,11 @@
3.22 double min, max;
3.23 min=node_property_defaults[N_RADIUS];
3.24 max=node_property_defaults[N_RADIUS];
3.25 - Graph::NodeMap<double> actual_map(mapstorage.graph,node_property_defaults[N_RADIUS]);
3.26 + Graph::NodeMap<double> actual_map((mainwin.mapstorage).graph,node_property_defaults[N_RADIUS]);
3.27
3.28 if(node==INVALID)
3.29 {
3.30 - for (NodeIt i(mapstorage.graph); i!=INVALID; ++i)
3.31 + for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
3.32 {
3.33 double v=fabs(actual_map[i]);
3.34 int w;
3.35 @@ -123,17 +123,17 @@
3.36 //green in RGB
3.37
3.38 Graph::NodeMap<double> * actual_map;
3.39 - actual_map=(mapstorage.nodemap_storage)[mapname];
3.40 + actual_map=((mainwin.mapstorage).nodemap_storage)[mapname];
3.41
3.42 double max, min;
3.43
3.44 - max=mapstorage.maxOfNodeMap(mapname);
3.45 - min=mapstorage.minOfNodeMap(mapname);
3.46 + max=(mainwin.mapstorage).maxOfNodeMap(mapname);
3.47 + min=(mainwin.mapstorage).minOfNodeMap(mapname);
3.48
3.49 if(node==INVALID)
3.50 {
3.51
3.52 - for (NodeIt i(mapstorage.graph); i!=INVALID; ++i)
3.53 + for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
3.54 {
3.55 Gdk::Color color;
3.56
3.57 @@ -178,7 +178,7 @@
3.58 //the minimum of the nodemap to the range of
3.59 //green in RGB
3.60
3.61 - Graph::NodeMap<double> actual_map(mapstorage.graph,node_property_defaults[N_COLOR]);
3.62 + Graph::NodeMap<double> actual_map((mainwin.mapstorage).graph,node_property_defaults[N_COLOR]);
3.63
3.64 double max, min;
3.65
3.66 @@ -188,7 +188,7 @@
3.67 if(node==INVALID)
3.68 {
3.69
3.70 - for (NodeIt i(mapstorage.graph); i!=INVALID; ++i)
3.71 + for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
3.72 {
3.73 Gdk::Color color;
3.74
3.75 @@ -235,11 +235,11 @@
3.76 //that is the deleter map
3.77
3.78 Graph::NodeMap<double> * actual_map=NULL;
3.79 - actual_map=(mapstorage.nodemap_storage)[mapname];
3.80 + actual_map=((mainwin.mapstorage).nodemap_storage)[mapname];
3.81
3.82 if(node==INVALID)
3.83 {
3.84 - for (NodeIt i(mapstorage.graph); i!=INVALID; ++i)
3.85 + for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
3.86 {
3.87 nodemap_to_edit=mapname;
3.88 double number=(*actual_map)[i];
3.89 @@ -272,7 +272,7 @@
3.90
3.91 if(node==INVALID)
3.92 {
3.93 - for (NodeIt i(mapstorage.graph); i!=INVALID; ++i)
3.94 + for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
3.95 {
3.96 nodemap_to_edit="";
3.97 nodetextmap[i]->property_text().set_value("");
4.1 --- a/gui/graph_displayer_canvas.cc Tue Nov 29 08:43:50 2005 +0000
4.2 +++ b/gui/graph_displayer_canvas.cc Tue Nov 29 19:31:58 2005 +0000
4.3 @@ -1,14 +1,12 @@
4.4 #include "graph_displayer_canvas.h"
4.5 #include <cmath>
4.6
4.7 -GraphDisplayerCanvas::GraphDisplayerCanvas(MapStorage & ms, MapWin & mw, Gtk::Window * mainwin) :
4.8 - nodesmap(ms.graph), edgesmap(ms.graph), edgetextmap(ms.graph),
4.9 - nodetextmap(ms.graph), displayed_graph(*(root()), 0, 0), mapstorage(ms),
4.10 +GraphDisplayerCanvas::GraphDisplayerCanvas(MainWin & mainw) :
4.11 + nodesmap(mainw.mapstorage.graph), edgesmap(mainw.mapstorage.graph), edgetextmap(mainw.mapstorage.graph),
4.12 + nodetextmap(mainw.mapstorage.graph), displayed_graph(*(root()), 0, 0),
4.13 isbutton(0), active_item(NULL), target_item(NULL), nodemap_to_edit(""),
4.14 - edgemap_to_edit(""), mapwin(mw)
4.15 + edgemap_to_edit(""), mainwin(mainw)
4.16 {
4.17 - parentwin=mainwin;
4.18 -
4.19 //base event handler is move tool
4.20 actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::moveEventHandler), false);
4.21 actual_tool=MOVE;
4.22 @@ -20,35 +18,155 @@
4.23
4.24 GraphDisplayerCanvas::~GraphDisplayerCanvas()
4.25 {
4.26 - for (NodeIt n(mapstorage.graph); n != INVALID; ++n)
4.27 - {
4.28 - delete nodesmap[n];
4.29 - delete nodetextmap[n];
4.30 - }
4.31 + for (NodeIt n((mainwin.mapstorage).graph); n != INVALID; ++n)
4.32 + {
4.33 + delete nodesmap[n];
4.34 + delete nodetextmap[n];
4.35 + }
4.36 +
4.37 + for (EdgeIt e((mainwin.mapstorage).graph); e != INVALID; ++e)
4.38 + {
4.39 + delete edgesmap[e];
4.40 + delete edgetextmap[e];
4.41 + }
4.42 +}
4.43
4.44 - for (EdgeIt e(mapstorage.graph); e != INVALID; ++e)
4.45 - {
4.46 - delete edgesmap[e];
4.47 - delete edgetextmap[e];
4.48 - }
4.49 +void GraphDisplayerCanvas::propertyChange(bool itisedge, int prop)
4.50 +{
4.51 + if(itisedge)
4.52 + {
4.53 + propertyUpdate(Edge(INVALID), prop);
4.54 + }
4.55 + else
4.56 + {
4.57 + propertyUpdate(Node(INVALID), prop);
4.58 + }
4.59 +}
4.60 +
4.61 +void GraphDisplayerCanvas::propertyUpdate(Edge edge)
4.62 +{
4.63 + for(int i=0;i<EDGE_PROPERTY_NUM;i++)
4.64 + {
4.65 + propertyUpdate(edge, i);
4.66 + }
4.67 +}
4.68 +
4.69 +void GraphDisplayerCanvas::propertyUpdate(Node node)
4.70 +{
4.71 + for(int i=0;i<NODE_PROPERTY_NUM;i++)
4.72 + {
4.73 + propertyUpdate(node, i);
4.74 + }
4.75 +}
4.76 +
4.77 +void GraphDisplayerCanvas::propertyUpdate(Node node, int prop, int dummy)
4.78 +{
4.79 + dummy=dummy;
4.80 +
4.81 + std::string mapname=mainwin.getActiveNodeMap(prop);
4.82 +
4.83 + if(mapname!="")
4.84 + {
4.85 + if( ( ((mainwin.mapstorage).nodemap_storage).find(mapname) != ((mainwin.mapstorage).nodemap_storage).end() ) )
4.86 + {
4.87 + switch(prop)
4.88 + {
4.89 + case N_RADIUS:
4.90 + changeNodeRadius(mapname, node);
4.91 + break;
4.92 + case N_COLOR:
4.93 + changeNodeColor(mapname, node);
4.94 + break;
4.95 + case N_TEXT:
4.96 + changeNodeText(mapname, node);
4.97 + break;
4.98 + default:
4.99 + std::cerr<<"Error\n";
4.100 + }
4.101 + }
4.102 + }
4.103 + else //mapname==""
4.104 + {
4.105 + Node node=INVALID;
4.106 + switch(prop)
4.107 + {
4.108 + case N_RADIUS:
4.109 + resetNodeRadius(node);
4.110 + break;
4.111 + case N_COLOR:
4.112 + resetNodeColor(node);
4.113 + break;
4.114 + case N_TEXT:
4.115 + resetNodeText(node);
4.116 + break;
4.117 + default:
4.118 + std::cerr<<"Error\n";
4.119 + }
4.120 + }
4.121 +
4.122 +}
4.123 +
4.124 +void GraphDisplayerCanvas::propertyUpdate(Edge edge, int prop, int dummy)
4.125 +{
4.126 + dummy=dummy;
4.127 +
4.128 + std::string mapname=mainwin.getActiveEdgeMap(prop);
4.129 +
4.130 + if(mapname!="")
4.131 + {
4.132 + if( ( ((mainwin.mapstorage).edgemap_storage).find(mapname) != ((mainwin.mapstorage).edgemap_storage).end() ) )
4.133 + {
4.134 + switch(prop)
4.135 + {
4.136 + case E_WIDTH:
4.137 + changeEdgeWidth(mapname, edge);
4.138 + break;
4.139 + case E_COLOR:
4.140 + changeEdgeColor(mapname, edge);
4.141 + break;
4.142 + case E_TEXT:
4.143 + changeEdgeText(mapname, edge);
4.144 + break;
4.145 + default:
4.146 + std::cerr<<"Error\n";
4.147 + }
4.148 + }
4.149 + }
4.150 + else //mapname==""
4.151 + {
4.152 + switch(prop)
4.153 + {
4.154 + case E_WIDTH:
4.155 + resetEdgeWidth(edge);
4.156 + break;
4.157 + case E_COLOR:
4.158 + resetEdgeColor(edge);
4.159 + break;
4.160 + case E_TEXT:
4.161 + resetEdgeText(edge);
4.162 + break;
4.163 + default:
4.164 + std::cerr<<"Error\n";
4.165 + }
4.166 + }
4.167 }
4.168
4.169 void GraphDisplayerCanvas::drawGraph()
4.170 {
4.171 //first edges are drawn, to hide joining with nodes later
4.172
4.173 - for (EdgeIt i(mapstorage.graph); i!=INVALID; ++i)
4.174 + for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
4.175 {
4.176
4.177 //drawing green lines, coordinates are from mapstorage.coords
4.178
4.179 Gnome::Canvas::Points coos;
4.180 coos.push_back(Gnome::Art::Point(
4.181 - mapstorage.coords[mapstorage.graph.source(i)].x,
4.182 - mapstorage.coords[mapstorage.graph.source(i)].y));
4.183 + (mainwin.mapstorage).coords[(mainwin.mapstorage).graph.source(i)].x,
4.184 + (mainwin.mapstorage).coords[(mainwin.mapstorage).graph.source(i)].y));
4.185 coos.push_back(Gnome::Art::Point(
4.186 - mapstorage.coords[mapstorage.graph.target(i)].x,
4.187 - mapstorage.coords[mapstorage.graph.target(i)].y));
4.188 + (mainwin.mapstorage).coords[(mainwin.mapstorage).graph.target(i)].x,
4.189 + (mainwin.mapstorage).coords[(mainwin.mapstorage).graph.target(i)].y));
4.190
4.191 edgesmap[i]=new BrokenEdge(displayed_graph, coos, *this);
4.192 *(edgesmap[i]) << Gnome::Canvas::Properties::fill_color("green");
4.193 @@ -68,16 +186,16 @@
4.194
4.195 //afterwards nodes come to be drawn
4.196
4.197 - for (NodeIt i(mapstorage.graph); i!=INVALID; ++i)
4.198 + for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
4.199 {
4.200 //drawing bule nodes, with black line around them
4.201
4.202 nodesmap[i]=new Gnome::Canvas::Ellipse(
4.203 displayed_graph,
4.204 - mapstorage.coords[i].x-20,
4.205 - mapstorage.coords[i].y-20,
4.206 - mapstorage.coords[i].x+20,
4.207 - mapstorage.coords[i].y+20);
4.208 + (mainwin.mapstorage).coords[i].x-20,
4.209 + (mainwin.mapstorage).coords[i].y-20,
4.210 + (mainwin.mapstorage).coords[i].x+20,
4.211 + (mainwin.mapstorage).coords[i].y+20);
4.212 *(nodesmap[i]) << Gnome::Canvas::Properties::fill_color("blue");
4.213 *(nodesmap[i]) << Gnome::Canvas::Properties::outline_color("black");
4.214 nodesmap[i]->raise_to_top();
4.215 @@ -85,8 +203,8 @@
4.216 //initializing edge-text as well, to empty string
4.217
4.218 xy<double> text_pos(
4.219 - (mapstorage.coords[i].x+node_property_defaults[N_RADIUS]+5),
4.220 - (mapstorage.coords[i].y+node_property_defaults[N_RADIUS]+5));
4.221 + ((mainwin.mapstorage).coords[i].x+node_property_defaults[N_RADIUS]+5),
4.222 + ((mainwin.mapstorage).coords[i].y+node_property_defaults[N_RADIUS]+5));
4.223
4.224 nodetextmap[i]=new Gnome::Canvas::Text(displayed_graph,
4.225 text_pos.x, text_pos.y, "");
4.226 @@ -104,13 +222,13 @@
4.227 active_edge=INVALID;
4.228 forming_edge=INVALID;
4.229
4.230 - for (NodeIt n(mapstorage.graph); n != INVALID; ++n)
4.231 + for (NodeIt n((mainwin.mapstorage).graph); n != INVALID; ++n)
4.232 {
4.233 delete nodesmap[n];
4.234 delete nodetextmap[n];
4.235 }
4.236
4.237 - for (EdgeIt e(mapstorage.graph); e != INVALID; ++e)
4.238 + for (EdgeIt e((mainwin.mapstorage).graph); e != INVALID; ++e)
4.239 {
4.240 delete edgesmap[e];
4.241 delete edgetextmap[e];
5.1 --- a/gui/graph_displayer_canvas.h Tue Nov 29 08:43:50 2005 +0000
5.2 +++ b/gui/graph_displayer_canvas.h Tue Nov 29 19:31:58 2005 +0000
5.3 @@ -6,8 +6,7 @@
5.4 class GraphDisplayerCanvas;
5.5
5.6 #include "all_include.h"
5.7 -#include "mapstorage.h"
5.8 -#include "map_win.h"
5.9 +#include "main_win.h"
5.10 #include <libgnomecanvasmm.h>
5.11 #include <libgnomecanvasmm/polygon.h>
5.12 #include <lemon/xy.h>
5.13 @@ -40,7 +39,7 @@
5.14 typedef Gnome::Canvas::CanvasAA Parent;
5.15
5.16 public:
5.17 - GraphDisplayerCanvas(MapStorage &, MapWin &, Gtk::Window *);
5.18 + GraphDisplayerCanvas(MainWin &);
5.19 virtual ~GraphDisplayerCanvas();
5.20
5.21 ///Changes the linewidth attribute according to the given map.
5.22 @@ -73,6 +72,13 @@
5.23 int changeNodeText (std::string mapname, Node new_item=INVALID);
5.24 int resetNodeText (Node new_item=INVALID);
5.25
5.26 + void propertyChange(bool, int);
5.27 + void propertyUpdate(Edge, int, int dummy=0);
5.28 + void propertyUpdate(Node, int, int dummy=0);
5.29 +
5.30 + void propertyUpdate(Edge);
5.31 + void propertyUpdate(Node);
5.32 +
5.33 ///Callback for 'ViewZoomIn' action.
5.34 virtual void zoomIn();
5.35 ///Callback for 'ViewZoomOut' action.
5.36 @@ -165,10 +171,6 @@
5.37 ///Group of graphical elements of displayed_graph
5.38 Gnome::Canvas::Group displayed_graph;
5.39
5.40 -public:
5.41 - ///Here we store the maps that can be displayed through properties.
5.42 - MapStorage & mapstorage;
5.43 -
5.44 private:
5.45 ///Indicates whether the button of mouse is pressed or not
5.46 int isbutton;
5.47 @@ -193,14 +195,10 @@
5.48
5.49 static const int zoom_step = 5;
5.50
5.51 -public:
5.52 - ///We need to store mapwin, to be able to ask the appropriate values for properties of new items.
5.53 - MapWin & mapwin;
5.54 -
5.55 private:
5.56
5.57 - ///pointer to the parent window
5.58 - Gtk::Window * parentwin;
5.59 + ///reference to the parent window
5.60 + MainWin & mainwin;
5.61
5.62 };
5.63
6.1 --- a/gui/main_win.cc Tue Nov 29 08:43:50 2005 +0000
6.2 +++ b/gui/main_win.cc Tue Nov 29 19:31:58 2005 +0000
6.3 @@ -1,14 +1,17 @@
6.4 #include "main_win.h"
6.5 #include "icons/guipixbufs.h"
6.6
6.7 -MainWin::MainWin() :
6.8 - mapwin("Map Setup", mapstorage, gd_canvas),
6.9 - gd_canvas(mapstorage, mapwin, (Gtk::Window *)this)
6.10 +MainWin::MainWin()
6.11 {
6.12 + mapwin=new MapWin("Map Setup", mapstorage.getEdgeMapList(), mapstorage.getNodeMapList(), *this);
6.13 + gd_canvas=new GraphDisplayerCanvas(*this);
6.14 +
6.15 set_title ("unsaved file - " + prog_name);
6.16 set_default_size(WIN_WIDTH,WIN_HEIGHT);
6.17 add(vbox);
6.18
6.19 + //connecting signals - controller character
6.20 + mapstorage.signal_prop_ch().connect(sigc::mem_fun(*gd_canvas, &GraphDisplayerCanvas::propertyChange));
6.21
6.22 // custom icons for the toolbar
6.23
6.24 @@ -92,35 +95,35 @@
6.25
6.26 ag->add( Gtk::Action::create("ViewMenu", "_View") );
6.27 ag->add( Gtk::Action::create("ViewZoomIn", Gtk::Stock::ZOOM_IN),
6.28 - sigc::mem_fun(this->gd_canvas, &GraphDisplayerCanvas::zoomIn));
6.29 + sigc::mem_fun(*(this->gd_canvas), &GraphDisplayerCanvas::zoomIn));
6.30 ag->add( Gtk::Action::create("ViewZoomOut", Gtk::Stock::ZOOM_OUT),
6.31 - sigc::mem_fun(this->gd_canvas, &GraphDisplayerCanvas::zoomOut));
6.32 + sigc::mem_fun(*(this->gd_canvas), &GraphDisplayerCanvas::zoomOut));
6.33 ag->add( Gtk::Action::create("ViewZoomFit", Gtk::Stock::ZOOM_FIT),
6.34 - sigc::mem_fun(this->gd_canvas, &GraphDisplayerCanvas::zoomFit));
6.35 + sigc::mem_fun(*(this->gd_canvas), &GraphDisplayerCanvas::zoomFit));
6.36 ag->add( Gtk::Action::create("ViewZoom100", Gtk::Stock::ZOOM_100),
6.37 - sigc::mem_fun(this->gd_canvas, &GraphDisplayerCanvas::zoom100));
6.38 + sigc::mem_fun(*(this->gd_canvas), &GraphDisplayerCanvas::zoom100));
6.39
6.40 ag->add( Gtk::Action::create("ShowMenu", "_Show") );
6.41 ag->add( Gtk::Action::create("ShowMaps", "_Maps"),
6.42 - sigc::mem_fun(this->mapwin, &MapWin::show));
6.43 + sigc::mem_fun(*(this->mapwin), &MapWin::show));
6.44
6.45 Gtk::RadioAction::Group tool_group;
6.46 ag->add( Gtk::RadioAction::create(tool_group, "MoveItem", Gtk::StockID("gd-move"), "Move"),
6.47 - sigc::bind( sigc::mem_fun ( this->gd_canvas, &GraphDisplayerCanvas::changeEditorialTool ), 0) );
6.48 + sigc::bind( sigc::mem_fun ( *(this->gd_canvas), &GraphDisplayerCanvas::changeEditorialTool ), 0) );
6.49 ag->add( Gtk::RadioAction::create(tool_group, "CreateNode", Gtk::StockID("gd-addnode"), "Create node"),
6.50 - sigc::bind( sigc::mem_fun ( this->gd_canvas, &GraphDisplayerCanvas::changeEditorialTool ), 1) );
6.51 + sigc::bind( sigc::mem_fun ( *(this->gd_canvas), &GraphDisplayerCanvas::changeEditorialTool ), 1) );
6.52 ag->add( Gtk::RadioAction::create(tool_group, "CreateEdge", Gtk::StockID("gd-addlink"), "Create edge"),
6.53 - sigc::bind( sigc::mem_fun ( this->gd_canvas, &GraphDisplayerCanvas::changeEditorialTool ), 2) );
6.54 + sigc::bind( sigc::mem_fun ( *(this->gd_canvas), &GraphDisplayerCanvas::changeEditorialTool ), 2) );
6.55 ag->add( Gtk::RadioAction::create(tool_group, "EraseItem", Gtk::StockID("gd-delete"), "Delete"),
6.56 - sigc::bind( sigc::mem_fun ( this->gd_canvas, &GraphDisplayerCanvas::changeEditorialTool ), 3) );
6.57 + sigc::bind( sigc::mem_fun ( *(this->gd_canvas), &GraphDisplayerCanvas::changeEditorialTool ), 3) );
6.58
6.59 ag->add( Gtk::RadioAction::create(tool_group, "EditEdgeMap", Gtk::StockID("gd-editlink"), "Edit edge map"),
6.60 - sigc::bind( sigc::mem_fun ( this->gd_canvas, &GraphDisplayerCanvas::changeEditorialTool ), 4) );
6.61 + sigc::bind( sigc::mem_fun ( *(this->gd_canvas), &GraphDisplayerCanvas::changeEditorialTool ), 4) );
6.62 ag->add( Gtk::RadioAction::create(tool_group, "EditNodeMap", Gtk::StockID("gd-editnode"), "Edit node map"),
6.63 - sigc::bind( sigc::mem_fun ( this->gd_canvas, &GraphDisplayerCanvas::changeEditorialTool ), 5) );
6.64 + sigc::bind( sigc::mem_fun ( *(this->gd_canvas), &GraphDisplayerCanvas::changeEditorialTool ), 5) );
6.65
6.66 ag->add( Gtk::Action::create("AddMap", Gtk::StockID("gd-newmap")),
6.67 - sigc::mem_fun (new NewMapWin("NewMapWin", gd_canvas), &NewMapWin::show ) );
6.68 + sigc::mem_fun (new NewMapWin("NewMapWin", *this), &NewMapWin::show ) );
6.69
6.70 uim=Gtk::UIManager::create();
6.71 uim->insert_action_group(ag);
6.72 @@ -194,7 +197,7 @@
6.73
6.74 Gtk::ScrolledWindow* pScrolledWindow = manage(new Gtk::ScrolledWindow());
6.75 pScrolledWindow->set_shadow_type(Gtk::SHADOW_IN);
6.76 - pScrolledWindow->add(gd_canvas);
6.77 + pScrolledWindow->add(*gd_canvas);
6.78 vbox.pack_start(*pScrolledWindow);
6.79
6.80 tooltips.set_tip(*(uim->get_widget("/ToolBar/CreateNode")),"Create Node");
6.81 @@ -208,8 +211,8 @@
6.82 mapstorage.readFromFile(file);
6.83 mapstorage.file_name = file;
6.84 mapstorage.modified = false;
6.85 - gd_canvas.drawGraph();
6.86 - mapwin.update();
6.87 + gd_canvas->drawGraph();
6.88 + mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
6.89 set_title(Glib::filename_display_basename(file) + " - " + prog_name);
6.90 }
6.91
6.92 @@ -233,9 +236,9 @@
6.93 break;
6.94 }
6.95 }
6.96 - gd_canvas.clear();
6.97 + gd_canvas->clear();
6.98 mapstorage.clear();
6.99 - mapwin.update();
6.100 + mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
6.101 set_title("unsaved file - " + prog_name);
6.102 }
6.103
6.104 @@ -264,15 +267,15 @@
6.105 fcdialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_ACCEPT);
6.106 if (fcdialog.run() == Gtk::RESPONSE_ACCEPT)
6.107 {
6.108 - gd_canvas.clear();
6.109 + gd_canvas->clear();
6.110 mapstorage.clear();
6.111 Glib::ustring filename = fcdialog.get_filename();
6.112 if (!mapstorage.readFromFile(filename))
6.113 {
6.114 mapstorage.file_name = filename;
6.115 mapstorage.modified = false;
6.116 - gd_canvas.drawGraph();
6.117 - mapwin.update();
6.118 + gd_canvas->drawGraph();
6.119 + mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
6.120 set_title(Glib::filename_display_basename(filename) + " - " + prog_name);
6.121 }
6.122 }
6.123 @@ -327,8 +330,39 @@
6.124 break;
6.125 }
6.126 }
6.127 - gd_canvas.clear();
6.128 + gd_canvas->clear();
6.129 mapstorage.clear();
6.130 - mapwin.update();
6.131 + mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
6.132 set_title("unsaved file - " + prog_name);
6.133 }
6.134 +
6.135 +void MainWin::propertyChange(bool itisedge, int prop, std::string mapname)
6.136 +{
6.137 + mapstorage.changeActiveMap(itisedge, prop, mapname);
6.138 +}
6.139 +
6.140 +void MainWin::popupNewMapWin(bool itisedge, int prop)
6.141 +{
6.142 + prop=prop;
6.143 + (new NewMapWin("NewMapWin", *this, itisedge, false))->run();
6.144 +}
6.145 +
6.146 +std::string MainWin::getActiveEdgeMap(int prop)
6.147 +{
6.148 + return mapstorage.getActiveEdgeMap(prop);
6.149 +}
6.150 +
6.151 +std::string MainWin::getActiveNodeMap(int prop)
6.152 +{
6.153 + return mapstorage.getActiveNodeMap(prop);
6.154 +}
6.155 +
6.156 +void MainWin::registerNewEdgeMap(std::string mapname)
6.157 +{
6.158 + mapwin->registerNewEdgeMap(mapname);
6.159 +}
6.160 +
6.161 +void MainWin::registerNewNodeMap(std::string mapname)
6.162 +{
6.163 + mapwin->registerNewNodeMap(mapname);
6.164 +}
7.1 --- a/gui/main_win.h Tue Nov 29 08:43:50 2005 +0000
7.2 +++ b/gui/main_win.h Tue Nov 29 19:31:58 2005 +0000
7.3 @@ -3,6 +3,8 @@
7.4 #ifndef MAIN_WIN_H
7.5 #define MAIN_WIN_H
7.6
7.7 +class MainWin;
7.8 +
7.9 #include "all_include.h"
7.10 #include "mapstorage.h"
7.11 #include "map_win.h"
7.12 @@ -26,10 +28,10 @@
7.13
7.14 protected:
7.15 ///Window of map-showing setup. Its type is \ref MapWin
7.16 - MapWin mapwin;
7.17 + MapWin * mapwin;
7.18
7.19 ///The graph will be drawn on this \ref GraphDisplayerCanvas
7.20 - GraphDisplayerCanvas gd_canvas;
7.21 + GraphDisplayerCanvas * gd_canvas;
7.22
7.23 ///ActionGroup for menu
7.24 Glib::RefPtr<Gtk::ActionGroup> ag;
7.25 @@ -53,6 +55,17 @@
7.26 virtual void saveFileAs();
7.27 ///Callback for 'Close' action.
7.28 virtual void close();
7.29 +
7.30 +public:
7.31 + void propertyChange(bool, int, std::string);
7.32 + void popupNewMapWin(bool, int);
7.33 +
7.34 + std::string getActiveEdgeMap(int);
7.35 + std::string getActiveNodeMap(int);
7.36 +
7.37 + void registerNewEdgeMap(std::string);
7.38 + void registerNewNodeMap(std::string);
7.39 +
7.40 };
7.41
7.42 #endif //MAIN_WIN_H
8.1 --- a/gui/map_win.cc Tue Nov 29 08:43:50 2005 +0000
8.2 +++ b/gui/map_win.cc Tue Nov 29 19:31:58 2005 +0000
8.3 @@ -10,7 +10,7 @@
8.4 return true;
8.5 }
8.6
8.7 -MapWin::MapWin(const std::string& title, MapStorage & mapst, GraphDisplayerCanvas & grdispc):gdc(grdispc),ms(mapst)
8.8 +MapWin::MapWin(const std::string& title, std::vector<std::string> eml, std::vector<std::string> nml, MainWin & mw):mainwin(mw)
8.9 {
8.10 set_title(title);
8.11 set_default_size(200, 50);
8.12 @@ -23,9 +23,12 @@
8.13
8.14 for(int i=0;i<EDGE_PROPERTY_NUM;i++)
8.15 {
8.16 - e_combo_array[i]=new MapSelector(gdc, ms, i, true);
8.17 + e_combo_array[i]=new MapSelector(eml, i, true);
8.18
8.19 (*table).attach((*(e_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
8.20 +
8.21 + e_combo_array[i]->signal_cbt_ch().connect(sigc::bind(sigc::mem_fun(*this, &MapWin::edgeMapChanged), i));
8.22 + e_combo_array[i]->signal_newmapwin_needed().connect(sigc::bind(sigc::mem_fun(*this, &MapWin::newMapWinNeeded), i));
8.23 }
8.24
8.25 vbox.pack_start(*(new Gtk::Label("Edge properties")));
8.26 @@ -40,9 +43,12 @@
8.27
8.28 for(int i=0;i<NODE_PROPERTY_NUM;i++)
8.29 {
8.30 - n_combo_array[i]=new MapSelector(gdc, ms, i, false);
8.31 + n_combo_array[i]=new MapSelector(nml, i, false);
8.32
8.33 (*table).attach((*(n_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
8.34 +
8.35 + n_combo_array[i]->signal_cbt_ch().connect(sigc::bind(sigc::mem_fun(*this, &MapWin::nodeMapChanged), i));
8.36 + n_combo_array[i]->signal_newmapwin_needed().connect(sigc::bind(sigc::mem_fun(*this, &MapWin::newMapWinNeeded), i));
8.37 }
8.38
8.39 add(vbox);
8.40 @@ -55,36 +61,34 @@
8.41
8.42 }
8.43
8.44 -void MapWin::update()
8.45 +void MapWin::nodeMapChanged(std::string mapname, int prop)
8.46 +{
8.47 + mainwin.propertyChange(false, prop, mapname);
8.48 +}
8.49 +
8.50 +void MapWin::edgeMapChanged(std::string mapname, int prop)
8.51 +{
8.52 + mainwin.propertyChange(true, prop, mapname);
8.53 +}
8.54 +
8.55 +void MapWin::newMapWinNeeded(bool itisedge, int prop)
8.56 +{
8.57 + mainwin.popupNewMapWin(itisedge, prop);
8.58 +}
8.59 +
8.60 +void MapWin::update(std::vector<std::string> eml, std::vector<std::string> nml)
8.61 {
8.62 for(int i=0;i<EDGE_PROPERTY_NUM;i++)
8.63 {
8.64 - e_combo_array[i]->update_list();
8.65 + e_combo_array[i]->update_list(eml);
8.66 }
8.67
8.68 for(int i=0;i<NODE_PROPERTY_NUM;i++)
8.69 {
8.70 - n_combo_array[i]->update_list();
8.71 + n_combo_array[i]->update_list(nml);
8.72 }
8.73 }
8.74
8.75 -
8.76 -void MapWin::updateNode(Node node)
8.77 -{
8.78 - for(int i=0;i<NODE_PROPERTY_NUM;i++)
8.79 - {
8.80 - n_combo_array[i]->update(node);
8.81 - }
8.82 -}
8.83 -
8.84 -void MapWin::updateEdge(Edge edge)
8.85 -{
8.86 - for(int i=0;i<EDGE_PROPERTY_NUM;i++)
8.87 - {
8.88 - e_combo_array[i]->update(edge);
8.89 - }
8.90 -}
8.91 -
8.92 void MapWin::registerNewEdgeMap(std::string newmapname)
8.93 {
8.94 for(int i=0;i<EDGE_PROPERTY_NUM;i++)
9.1 --- a/gui/map_win.h Tue Nov 29 08:43:50 2005 +0000
9.2 +++ b/gui/map_win.h Tue Nov 29 19:31:58 2005 +0000
9.3 @@ -5,10 +5,8 @@
9.4
9.5 class MapWin;
9.6
9.7 -#include "all_include.h"
9.8 -#include "graph_displayer_canvas.h"
9.9 -#include "mapstorage.h"
9.10 -#include "new_map_win.h"
9.11 +#include <all_include.h>
9.12 +#include <main_win.h>
9.13 #include <libgnomecanvasmm.h>
9.14 #include <libgnomecanvasmm/polygon.h>
9.15
9.16 @@ -21,9 +19,8 @@
9.17 class MapSelector : public Gtk::HBox
9.18 {
9.19 protected:
9.20 - GraphDisplayerCanvas & gdc;
9.21 - ///The \ref MapStorage in which the visualizable maps are stored
9.22 - MapStorage & ms;
9.23 + sigc::signal<void, std::string> signal_cbt;
9.24 + sigc::signal<void, bool> signal_newmapwin;
9.25
9.26 int id;
9.27
9.28 @@ -41,15 +38,14 @@
9.29
9.30 Gtk::Label * label;
9.31
9.32 - Node node_to_update;
9.33 - Edge edge_to_update;
9.34 -
9.35 -
9.36 public:
9.37
9.38 - MapSelector(GraphDisplayerCanvas &, MapStorage &, int, bool);
9.39 + MapSelector(std::vector<std::string>, int, bool);
9.40
9.41 - void update_list();
9.42 + sigc::signal<void, std::string> signal_cbt_ch();
9.43 + sigc::signal<void, bool> signal_newmapwin_needed();
9.44 +
9.45 + void update_list( std::vector<std::string> );
9.46
9.47 ///If a radiobutton is clicked, this function determines
9.48 ///which button was that and after that calls the
9.49 @@ -61,9 +57,6 @@
9.50
9.51 virtual void reset();
9.52
9.53 - virtual void update(Node node);
9.54 - virtual void update(Edge edge);
9.55 -
9.56 Glib::ustring get_active_text();
9.57 void set_active_text(Glib::ustring);
9.58 void append_text(Glib::ustring);
9.59 @@ -72,14 +65,7 @@
9.60
9.61
9.62 protected:
9.63 - ///The \ref GraphDisplayerCanvas on which the graph will be drawn.
9.64 - ///It has to be known for this class, because
9.65 - ///when a map assigned to a certain attribute
9.66 - ///a function of the \ref GraphDisplayerCanvas will be called.
9.67 - GraphDisplayerCanvas & gdc;
9.68 -
9.69 - ///The \ref MapStorage in which the visualizable maps are stored
9.70 - MapStorage & ms;
9.71 + MainWin & mainwin;
9.72
9.73 Gtk::Table * table;
9.74
9.75 @@ -91,13 +77,13 @@
9.76
9.77 public:
9.78 ///Constructor of MapWin creates the widgets shown in MapWin.
9.79 - MapWin(const std::string& title, MapStorage &, GraphDisplayerCanvas &);
9.80 + MapWin(const std::string& title, std::vector<std::string>, std::vector<std::string>, MainWin & mw);
9.81
9.82 - ///This function is created to set the appropriate maps on the newly created node
9.83 - void updateNode(Graph::Node);
9.84 + void nodeMapChanged(std::string, int);
9.85
9.86 - ///This function is created to set the appropriate maps on the newly created edge
9.87 - void updateEdge(Graph::Edge);
9.88 + void edgeMapChanged(std::string, int);
9.89 +
9.90 + void newMapWinNeeded(bool, int);
9.91
9.92 ///This function inserts name of the new edgemap in the list in the combo box
9.93 void registerNewEdgeMap(std::string);
9.94 @@ -107,7 +93,7 @@
9.95
9.96 virtual bool closeIfEscapeIsPressed(GdkEventKey*);
9.97
9.98 - void update();
9.99 + void update(std::vector<std::string>, std::vector<std::string>);
9.100 };
9.101
9.102 #endif //MAP_WIN_H
10.1 --- a/gui/mapstorage.cc Tue Nov 29 08:43:50 2005 +0000
10.2 +++ b/gui/mapstorage.cc Tue Nov 29 19:31:58 2005 +0000
10.3 @@ -16,6 +16,18 @@
10.4
10.5 nodemap_default["id"] = 1.0;
10.6 edgemap_default["id"] = 1.0;
10.7 +
10.8 + active_nodemaps.resize(NODE_PROPERTY_NUM);
10.9 + for(int i=0;i<NODE_PROPERTY_NUM;i++)
10.10 + {
10.11 + active_nodemaps[i]="";
10.12 + }
10.13 +
10.14 + active_edgemaps.resize(EDGE_PROPERTY_NUM);
10.15 + for(int i=0;i<EDGE_PROPERTY_NUM;i++)
10.16 + {
10.17 + active_edgemaps[i]="";
10.18 + }
10.19 }
10.20
10.21 MapStorage::~MapStorage()
10.22 @@ -44,6 +56,62 @@
10.23 return 1;
10.24 }
10.25
10.26 +void MapStorage::changeActiveMap(bool itisedge, int prop, std::string mapname)
10.27 +{
10.28 + if(itisedge)
10.29 + {
10.30 + active_edgemaps[prop]=mapname;
10.31 + }
10.32 + else
10.33 + {
10.34 + active_nodemaps[prop]=mapname;
10.35 + }
10.36 + signal_prop.emit(itisedge, prop);
10.37 +}
10.38 +
10.39 +std::string MapStorage::getActiveEdgeMap(int prop)
10.40 +{
10.41 + return active_edgemaps[prop];
10.42 +}
10.43 +
10.44 +std::string MapStorage::getActiveNodeMap(int prop)
10.45 +{
10.46 + return active_nodemaps[prop];
10.47 +}
10.48 +
10.49 +std::vector<std::string> MapStorage::getEdgeMapList()
10.50 +{
10.51 + std::vector<std::string> eml;
10.52 + eml.resize(edgemap_storage.size());
10.53 + int i=0;
10.54 + std::map< std::string,Graph::EdgeMap<double> * >::iterator emsi=beginOfEdgeMaps();
10.55 + for(;emsi!=endOfEdgeMaps();emsi++)
10.56 + {
10.57 + eml[i]=(emsi->first);
10.58 + i++;
10.59 + }
10.60 + return eml;
10.61 +}
10.62 +
10.63 +std::vector<std::string> MapStorage::getNodeMapList()
10.64 +{
10.65 + std::vector<std::string> nml;
10.66 + nml.resize(nodemap_storage.size());
10.67 + int i=0;
10.68 + std::map< std::string,Graph::NodeMap<double> * >::iterator nmsi=beginOfNodeMaps();
10.69 + for(;nmsi!=endOfNodeMaps();nmsi++)
10.70 + {
10.71 + nml[i]=(nmsi->first);
10.72 + i++;
10.73 + }
10.74 + return nml;
10.75 +}
10.76 +
10.77 +MapStorage::Signal_Prop MapStorage::signal_prop_ch()
10.78 +{
10.79 + return signal_prop;
10.80 +}
10.81 +
10.82 int MapStorage::addEdgeMap(const std::string & name, Graph::EdgeMap<double> *edgemap, double default_value = 0.0)
10.83 {
10.84 if( edgemap_storage.find(name) == edgemap_storage.end() )
11.1 --- a/gui/mapstorage.h Tue Nov 29 08:43:50 2005 +0000
11.2 +++ b/gui/mapstorage.h Tue Nov 29 19:31:58 2005 +0000
11.3 @@ -3,8 +3,11 @@
11.4 #ifndef MAPSTORAGE_H
11.5 #define MAPSTORAGE_H
11.6
11.7 +class Mapstorage;
11.8 +
11.9 #include "all_include.h"
11.10 #include "xymap.h"
11.11 +#include <libgnomecanvasmm.h>
11.12
11.13 ///Class MapStorage is responsible for storing
11.14 ///NodeMaps and EdgeMaps that can be shown later
11.15 @@ -37,12 +40,22 @@
11.16 //Stores the default values for the different visualization edge attributes
11.17 std::vector<Graph::EdgeMap<double> > default_edgemaps;
11.18
11.19 + //Stores the active maps for the different visualization node attributes
11.20 + std::vector< std::string > active_nodemaps;
11.21 +
11.22 + //Stores the active maps for the different visualization edge attributes
11.23 + std::vector< std::string > active_edgemaps;
11.24 +
11.25 // Default values for the maps
11.26 std::map< std::string, double > nodemap_default;
11.27
11.28 // Default values for the maps
11.29 std::map< std::string, double > edgemap_default;
11.30
11.31 +protected:
11.32 + typedef sigc::signal<void, bool, int> Signal_Prop;
11.33 + Signal_Prop signal_prop;
11.34 +
11.35 public:
11.36 ///Constructor of MapStorage. Expects the Graph of
11.37 ///which maps will be stored in it.
11.38 @@ -54,6 +67,16 @@
11.39
11.40 ~MapStorage();
11.41
11.42 + void changeActiveMap(bool, int, std::string);
11.43 +
11.44 + std::string getActiveEdgeMap(int);
11.45 + std::string getActiveNodeMap(int);
11.46 +
11.47 + std::vector<std::string> getEdgeMapList();
11.48 + std::vector<std::string> getNodeMapList();
11.49 +
11.50 + Signal_Prop signal_prop_ch();
11.51 +
11.52 ///Adds given map to storage. A name and the map itself has to be provided.
11.53 ///\param name is the name of map
11.54 ///\nodemap is the pointer of the given nodemap
12.1 --- a/gui/mw-mapselector.cc Tue Nov 29 08:43:50 2005 +0000
12.2 +++ b/gui/mw-mapselector.cc Tue Nov 29 19:31:58 2005 +0000
12.3 @@ -1,8 +1,8 @@
12.4 #include "map_win.h"
12.5
12.6 -MapWin::MapSelector::MapSelector(GraphDisplayerCanvas & grdispc, MapStorage & mapst, int identifier, bool edge):gdc(grdispc),ms(mapst),id(identifier),itisedge(edge),default_state(true),set_new_map(false),node_to_update(INVALID),edge_to_update(INVALID)
12.7 +MapWin::MapSelector::MapSelector(std::vector<std::string> ml, int identifier, bool edge):id(identifier),itisedge(edge),default_state(true),set_new_map(false)
12.8 {
12.9 - update_list();
12.10 + update_list(ml);
12.11
12.12 cbt.set_active(0);
12.13
12.14 @@ -50,27 +50,16 @@
12.15 void MapWin::MapSelector::new_but_pressed()
12.16 {
12.17 set_new_map=true;
12.18 - (new NewMapWin("NewMapWin", gdc, itisedge, false))->run();
12.19 + signal_newmapwin.emit(itisedge);
12.20 }
12.21
12.22 -void MapWin::MapSelector::update_list()
12.23 +void MapWin::MapSelector::update_list( std::vector< std::string > ml )
12.24 {
12.25 cbt.clear();
12.26 - if(itisedge)
12.27 + std::vector< std::string >::iterator emsi=ml.begin();
12.28 + for(;emsi!=ml.end();emsi++)
12.29 {
12.30 - std::map< std::string,Graph::EdgeMap<double> * >::iterator emsi=ms.beginOfEdgeMaps();
12.31 - for(;emsi!=ms.endOfEdgeMaps();emsi++)
12.32 - {
12.33 - cbt.append_text(emsi->first);
12.34 - }
12.35 - }
12.36 - else
12.37 - {
12.38 - std::map< std::string,Graph::NodeMap<double> * >::iterator emsi=ms.beginOfNodeMaps();
12.39 - for(;emsi!=ms.endOfNodeMaps();emsi++)
12.40 - {
12.41 - cbt.append_text(emsi->first);
12.42 - }
12.43 + cbt.append_text(*emsi);
12.44 }
12.45 cbt.prepend_text("Default values");
12.46 }
12.47 @@ -83,52 +72,12 @@
12.48 Glib::ustring mapname = cbt.get_active_text();
12.49 if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
12.50 {
12.51 - if(itisedge)
12.52 - {
12.53 - if( ( (ms.edgemap_storage).find(mapname) != (ms.edgemap_storage).end() ) )
12.54 - {
12.55 - Edge edge=edge_to_update;
12.56 - switch(id)
12.57 - {
12.58 - case E_WIDTH:
12.59 - gdc.changeEdgeWidth(mapname, edge);
12.60 - break;
12.61 - case E_COLOR:
12.62 - gdc.changeEdgeColor(mapname, edge);
12.63 - break;
12.64 - case E_TEXT:
12.65 - gdc.changeEdgeText(mapname, edge);
12.66 - break;
12.67 - default:
12.68 - std::cerr<<"Error\n";
12.69 - }
12.70 - }
12.71 - }
12.72 - else
12.73 - {
12.74 - if( ( (ms.nodemap_storage).find(mapname) != (ms.nodemap_storage).end() ) )
12.75 - {
12.76 - Node node=node_to_update;
12.77 - switch(id)
12.78 - {
12.79 - case N_RADIUS:
12.80 - gdc.changeNodeRadius(mapname, node);
12.81 - break;
12.82 - case N_COLOR:
12.83 - gdc.changeNodeColor(mapname, node);
12.84 - break;
12.85 - case N_TEXT:
12.86 - gdc.changeNodeText(mapname, node);
12.87 - break;
12.88 - default:
12.89 - std::cerr<<"Error\n";
12.90 - }
12.91 - }
12.92 - }
12.93 + signal_cbt.emit(mapname);
12.94 }
12.95 }
12.96 else if((!default_state)&&(cbt.get_active_row_number()==0))
12.97 {
12.98 + signal_cbt.emit("");
12.99 reset();
12.100 }
12.101 }
12.102 @@ -138,71 +87,9 @@
12.103 default_state=true;
12.104 cbt.set_active(0);
12.105
12.106 - if(itisedge)
12.107 - {
12.108 - Edge edge=edge_to_update;
12.109 - switch(id)
12.110 - {
12.111 - case E_WIDTH:
12.112 - gdc.resetEdgeWidth(edge);
12.113 - break;
12.114 - case E_COLOR:
12.115 - gdc.resetEdgeColor(edge);
12.116 - break;
12.117 - case E_TEXT:
12.118 - gdc.resetEdgeText(edge);
12.119 - break;
12.120 - default:
12.121 - std::cerr<<"Error\n";
12.122 - }
12.123 - }
12.124 - else
12.125 - {
12.126 - Node node=node_to_update;
12.127 - switch(id)
12.128 - {
12.129 - case N_RADIUS:
12.130 - gdc.resetNodeRadius(node);
12.131 - break;
12.132 - case N_COLOR:
12.133 - gdc.resetNodeColor(node);
12.134 - break;
12.135 - case N_TEXT:
12.136 - gdc.resetNodeText(node);
12.137 - break;
12.138 - default:
12.139 - std::cerr<<"Error\n";
12.140 - }
12.141 - }
12.142 + signal_cbt.emit("");
12.143 }
12.144
12.145 -void MapWin::MapSelector::update(Node node)
12.146 -{
12.147 - node_to_update=node;
12.148 - if(default_state)
12.149 - {
12.150 - reset();
12.151 - }
12.152 - else
12.153 - {
12.154 - comboChanged();
12.155 - }
12.156 - node_to_update=INVALID;
12.157 -}
12.158 -
12.159 -void MapWin::MapSelector::update(Edge edge)
12.160 -{
12.161 - edge_to_update=edge;
12.162 - if(default_state)
12.163 - {
12.164 - reset();
12.165 - }
12.166 - else
12.167 - {
12.168 - comboChanged();
12.169 - }
12.170 - edge_to_update=INVALID;
12.171 -}
12.172
12.173 Glib::ustring MapWin::MapSelector::get_active_text()
12.174 {
12.175 @@ -223,3 +110,13 @@
12.176 set_new_map=false;
12.177 }
12.178 }
12.179 +
12.180 +sigc::signal<void, std::string> MapWin::MapSelector::signal_cbt_ch()
12.181 +{
12.182 + return signal_cbt;
12.183 +}
12.184 +
12.185 +sigc::signal<void, bool> MapWin::MapSelector::signal_newmapwin_needed()
12.186 +{
12.187 + return signal_newmapwin;
12.188 +}
13.1 --- a/gui/new_map_win.cc Tue Nov 29 08:43:50 2005 +0000
13.2 +++ b/gui/new_map_win.cc Tue Nov 29 19:31:58 2005 +0000
13.3 @@ -9,7 +9,7 @@
13.4 return true;
13.5 }
13.6
13.7 -NewMapWin::NewMapWin(const std::string& title, GraphDisplayerCanvas & grdispc, bool itisedge, bool edgenode):Gtk::Dialog(title, true, true),gdc(grdispc),node("Create NodeMap"),edge("Create EdgeMap")
13.8 +NewMapWin::NewMapWin(const std::string& title, MainWin & mw, bool itisedge, bool edgenode):Gtk::Dialog(title, true, true),mainwin(mw),node("Create NodeMap"),edge("Create EdgeMap")
13.9 {
13.10 set_default_size(200, 50);
13.11
13.12 @@ -83,11 +83,11 @@
13.13 if(edge.get_active())
13.14 {
13.15 //create the new map
13.16 - Graph::EdgeMap<double> * emptr=new Graph::EdgeMap<double> (gdc.mapstorage.graph);
13.17 + Graph::EdgeMap<double> * emptr=new Graph::EdgeMap<double> (mainwin.mapstorage.graph);
13.18
13.19 std::stack<double> polishstack;
13.20
13.21 - for(EdgeIt k(gdc.mapstorage.graph); k!=INVALID; ++k)
13.22 + for(EdgeIt k(mainwin.mapstorage.graph); k!=INVALID; ++k)
13.23 {
13.24 for(int i=0;i<(int)polishform.size();i++)
13.25 {
13.26 @@ -106,11 +106,11 @@
13.27 break;
13.28 default:
13.29 //substitute variable
13.30 - std::map< std::string,Graph::EdgeMap<double> * > ems=gdc.mapstorage.edgemap_storage;
13.31 + std::map< std::string,Graph::EdgeMap<double> * > ems=mainwin.mapstorage.edgemap_storage;
13.32 bool itisvar=(ems.find(ch2var[ polishform[i] ])!=ems.end());
13.33 if(itisvar)
13.34 {
13.35 - polishstack.push( (*(gdc.mapstorage.edgemap_storage[ ch2var[ polishform[i] ] ]))[k]);
13.36 + polishstack.push( (*(mainwin.mapstorage.edgemap_storage[ ch2var[ polishform[i] ] ]))[k]);
13.37 }
13.38 else
13.39 {
13.40 @@ -153,25 +153,25 @@
13.41
13.42 //if addition was not successful addEdgeMap returns one.
13.43 //cause can be that there is already a map named like the new one
13.44 - if(gdc.mapstorage.addEdgeMap(mapname, emptr, def_val))
13.45 + if(mainwin.mapstorage.addEdgeMap(mapname, emptr, def_val))
13.46 {
13.47 abortion=1;
13.48 }
13.49
13.50 //add it to the list of the displayable maps
13.51 - gdc.mapwin.registerNewEdgeMap(mapname);
13.52 + mainwin.registerNewEdgeMap(mapname);
13.53
13.54 //display it
13.55 - gdc.changeEdgeText(mapname);
13.56 + //gdc.changeEdgeText(mapname);
13.57 }
13.58 else //!edge.get_active()
13.59 {
13.60 //create the new map
13.61 - Graph::NodeMap<double> * emptr=new Graph::NodeMap<double> (gdc.mapstorage.graph);
13.62 + Graph::NodeMap<double> * emptr=new Graph::NodeMap<double> (mainwin.mapstorage.graph);
13.63
13.64 std::stack<double> polishstack;
13.65
13.66 - for(NodeIt k(gdc.mapstorage.graph); k!=INVALID; ++k)
13.67 + for(NodeIt k(mainwin.mapstorage.graph); k!=INVALID; ++k)
13.68 {
13.69 for(int i=0;i<(int)polishform.size();i++)
13.70 {
13.71 @@ -189,11 +189,11 @@
13.72 polishstack.pop();
13.73 break;
13.74 default:
13.75 - std::map< std::string,Graph::NodeMap<double> * > nms=gdc.mapstorage.nodemap_storage;
13.76 + std::map< std::string,Graph::NodeMap<double> * > nms=mainwin.mapstorage.nodemap_storage;
13.77 bool itisvar=(nms.find(ch2var[ polishform[i] ])!=nms.end());
13.78 if(itisvar)
13.79 {
13.80 - polishstack.push( (*(gdc.mapstorage.nodemap_storage[ ch2var[ polishform[i] ] ]))[k]);
13.81 + polishstack.push( (*(mainwin.mapstorage.nodemap_storage[ ch2var[ polishform[i] ] ]))[k]);
13.82 }
13.83 else
13.84 {
13.85 @@ -236,13 +236,13 @@
13.86
13.87 //if addition was not successful addNodeMap returns one.
13.88 //cause can be that there is already a map named like the new one
13.89 - if(gdc.mapstorage.addNodeMap(mapname,emptr, def_val))
13.90 + if(mainwin.mapstorage.addNodeMap(mapname,emptr, def_val))
13.91 {
13.92 abortion=1;
13.93 }
13.94
13.95 //add it to the list of the displayable maps
13.96 - gdc.mapwin.registerNewNodeMap(mapname);
13.97 + mainwin.registerNewNodeMap(mapname);
13.98
13.99 //display it
13.100 //gdc.changeNodeText(mapname);
13.101 @@ -431,11 +431,11 @@
13.102 //is it mapname?
13.103 if(itisedge)
13.104 {
13.105 - cancel=(gdc.mapstorage.edgemap_storage.find(variable)==gdc.mapstorage.edgemap_storage.end());
13.106 + cancel=(mainwin.mapstorage.edgemap_storage.find(variable)==mainwin.mapstorage.edgemap_storage.end());
13.107 }
13.108 else
13.109 {
13.110 - cancel=(gdc.mapstorage.nodemap_storage.find(variable)==gdc.mapstorage.nodemap_storage.end());
13.111 + cancel=(mainwin.mapstorage.nodemap_storage.find(variable)==mainwin.mapstorage.nodemap_storage.end());
13.112 }
13.113 //maybe it is number
13.114 int point_num=0;
14.1 --- a/gui/new_map_win.h Tue Nov 29 08:43:50 2005 +0000
14.2 +++ b/gui/new_map_win.h Tue Nov 29 19:31:58 2005 +0000
14.3 @@ -6,7 +6,7 @@
14.4 class NewMapWin;
14.5
14.6 #include <all_include.h>
14.7 -#include <graph_displayer_canvas.h>
14.8 +#include <main_win.h>
14.9 #include <libgnomecanvasmm.h>
14.10 #include <libgnomecanvasmm/polygon.h>
14.11 #include <stack>
14.12 @@ -16,11 +16,7 @@
14.13
14.14 class NewMapWin : public Gtk::Dialog
14.15 {
14.16 - ///The \ref GraphDisplayerCanvas on which the graph will be drawn.
14.17 - ///It has to be known for this class, because
14.18 - ///when a map is created
14.19 - ///a function of the \ref GraphDisplayerCanvas will be called.
14.20 - GraphDisplayerCanvas & gdc;
14.21 + MainWin & mainwin;
14.22
14.23 public:
14.24 struct tree_node
14.25 @@ -31,7 +27,7 @@
14.26 };
14.27
14.28 ///Constructor of NewMapWin creates the widgets shown in NewMapWin.
14.29 - NewMapWin(const std::string& title, GraphDisplayerCanvas &, bool itisedge=true, bool edgenode=true);
14.30 + NewMapWin(const std::string& title, MainWin &, bool itisedge=true, bool edgenode=true);
14.31
14.32 ///Signal on button is connected to this function,
14.33 ///Therefore this function determines whether to