# HG changeset patch # User alpar # Date 1124372029 0 # Node ID 9285f3777553f7e747f3daf64d856da1cfe45333 # Parent a2dda876316fc44274aeba3ee8d4dea9ecbf22a8 - The number of gcc-4.0 warnings has significantly decreases. - Some code clean-up in gui diff -r a2dda876316f -r 9285f3777553 gui/all_include.h --- a/gui/all_include.h Thu Aug 18 12:22:44 2005 +0000 +++ b/gui/all_include.h Thu Aug 18 13:33:49 2005 +0000 @@ -40,6 +40,7 @@ typedef ListGraph Graph; typedef Graph::NodeMap CoordinatesMap; typedef Graph::Node Node; +typedef Graph::Edge Edge; typedef Graph::EdgeIt EdgeIt; typedef Graph::NodeIt NodeIt; diff -r a2dda876316f -r 9285f3777553 gui/graph_displayer_canvas-edge.cc --- a/gui/graph_displayer_canvas-edge.cc Thu Aug 18 12:22:44 2005 +0000 +++ b/gui/graph_displayer_canvas-edge.cc Thu Aug 18 13:33:49 2005 +0000 @@ -3,7 +3,7 @@ #include -int GraphDisplayerCanvas::changeEdgeWidth (std::string mapname, Graph::Edge edge) +int GraphDisplayerCanvas::changeEdgeWidth (std::string mapname, Edge edge) { Graph::EdgeMap * actual_map; double min, max; @@ -49,7 +49,7 @@ return 0; }; -int GraphDisplayerCanvas::changeEdgeColor (std::string mapname, Graph::Edge edge) +int GraphDisplayerCanvas::changeEdgeColor (std::string mapname, Edge edge) { //function maps the range of the maximum and @@ -116,7 +116,7 @@ return 0; }; -int GraphDisplayerCanvas::changeEdgeText (std::string mapname, Graph::Edge edge) +int GraphDisplayerCanvas::changeEdgeText (std::string mapname, Edge edge) { //the number in the map will be written on the edge //EXCEPT when the name of the map is Default, because diff -r a2dda876316f -r 9285f3777553 gui/graph_displayer_canvas-event.cc --- a/gui/graph_displayer_canvas-event.cc Thu Aug 18 12:22:44 2005 +0000 +++ b/gui/graph_displayer_canvas-event.cc Thu Aug 18 13:33:49 2005 +0000 @@ -225,7 +225,7 @@ isbutton=1; - active_node=NodeIt(mapstorage.graph,mapstorage.graph.addNode()); + active_node=mapstorage.graph.addNode(); //initiating values corresponding to new node in maps @@ -339,7 +339,7 @@ { window_to_world (e->button.x, e->button.y, clicked_x, clicked_y); target_item=(get_item_at(clicked_x, clicked_y)); - Graph::NodeIt target_node=INVALID; + Node target_node=INVALID; for (NodeIt i(mapstorage.graph); i!=INVALID; ++i) { if(nodesmap[i]==target_item) @@ -354,14 +354,17 @@ { mapstorage.modified = true; - *(nodesmap[target_node]) << Gnome::Canvas::Properties::fill_color("red"); + *(nodesmap[target_node]) << + Gnome::Canvas::Properties::fill_color("red"); //creating new edge - active_edge=EdgeIt(mapstorage.graph,mapstorage.graph.addEdge(active_node, target_node)); + active_edge=mapstorage.graph.addEdge(active_node, + target_node); //initiating values corresponding to new edge in maps mapstorage.initMapsForEdge(active_edge); - (*mapstorage.edgemap_storage["id"])[active_edge] = mapstorage.graph.id(active_edge); + (*mapstorage.edgemap_storage["id"])[active_edge] = + mapstorage.graph.id(active_edge); //calculating coordinates of new edge Gnome::Canvas::Points coos; @@ -555,7 +558,7 @@ //If the click happened on an edge we place the entrywidget there and fill in the value of the activated map at that edge. { //for determine, whether it was an edge - Graph::EdgeIt clicked_edge=INVALID; + Edge clicked_edge=INVALID; //find the activated item between texts active_item=(get_item_at(e->button.x, e->button.y)); @@ -677,7 +680,7 @@ //If the click happened on an edge we place the entrywidget there and fill in the value of the activated map at that edge. { //for determine, whether it was a node - Graph::NodeIt clicked_node=INVALID; + Node clicked_node=INVALID; //find the activated item between texts active_item=(get_item_at(e->button.x, e->button.y)); @@ -849,21 +852,14 @@ return false; } -void GraphDisplayerCanvas::deleteItem(NodeIt node_to_delete) +void GraphDisplayerCanvas::deleteItem(Node node_to_delete) { delete(nodetextmap[node_to_delete]); delete(nodesmap[node_to_delete]); mapstorage.graph.erase(node_to_delete); } -void GraphDisplayerCanvas::deleteItem(EdgeIt edge_to_delete) -{ - delete(edgetextmap[edge_to_delete]); - delete(edgesmap[edge_to_delete]); - mapstorage.graph.erase(edge_to_delete); -} - -void GraphDisplayerCanvas::deleteItem(Graph::Edge edge_to_delete) +void GraphDisplayerCanvas::deleteItem(Edge edge_to_delete) { delete(edgetextmap[edge_to_delete]); delete(edgesmap[edge_to_delete]); diff -r a2dda876316f -r 9285f3777553 gui/graph_displayer_canvas-node.cc --- a/gui/graph_displayer_canvas-node.cc Thu Aug 18 12:22:44 2005 +0000 +++ b/gui/graph_displayer_canvas-node.cc Thu Aug 18 13:33:49 2005 +0000 @@ -3,7 +3,7 @@ #include -int GraphDisplayerCanvas::changeNodeRadius (std::string mapname, Graph::Node node) +int GraphDisplayerCanvas::changeNodeRadius (std::string mapname, Node node) { Graph::NodeMap * actual_map; double min, max; @@ -69,7 +69,7 @@ return 0; }; -int GraphDisplayerCanvas::changeNodeColor (std::string mapname, Graph::Node node) +int GraphDisplayerCanvas::changeNodeColor (std::string mapname, Node node) { //function maps the range of the maximum and @@ -141,7 +141,7 @@ return 0; }; -int GraphDisplayerCanvas::changeNodeText (std::string mapname, Graph::Node node) +int GraphDisplayerCanvas::changeNodeText (std::string mapname, Node node) { //the number in the map will be written on the node diff -r a2dda876316f -r 9285f3777553 gui/graph_displayer_canvas.h --- a/gui/graph_displayer_canvas.h Thu Aug 18 12:22:44 2005 +0000 +++ b/gui/graph_displayer_canvas.h Thu Aug 18 13:33:49 2005 +0000 @@ -23,27 +23,27 @@ ///Changes the linewidth attribute according to the given map. ///\param mapname is the name of the map which contains the new values - int changeEdgeWidth (std::string mapname, Graph::Edge new_item=INVALID); + int changeEdgeWidth (std::string mapname, Edge new_item=INVALID); ///Changes the linecolor attribute according to the given map. ///\param mapname is the name of the map which contains the new values - int changeEdgeColor (std::string mapname, Graph::Edge new_item=INVALID); + int changeEdgeColor (std::string mapname, Edge new_item=INVALID); ///Changes the text of line attribute according to the given map. ///\param mapname is the name of the map which contains the new values - int changeEdgeText (std::string mapname, Graph::Edge new_item=INVALID); + int changeEdgeText (std::string mapname, Edge new_item=INVALID); ///Changes the linewidth attribute according to the given map. ///\param mapname is the name of the map which contains the new values - int changeNodeRadius (std::string mapname, Graph::Node new_item=INVALID); + int changeNodeRadius (std::string mapname, Node new_item=INVALID); ///Changes the linecolor attribute according to the given map. ///\param mapname is the name of the map which contains the new values - int changeNodeColor (std::string mapname, Graph::Node new_item=INVALID); + int changeNodeColor (std::string mapname, Node new_item=INVALID); ///Changes the text of line attribute according to the given map. ///\param mapname is the name of the map which contains the new values - int changeNodeText (std::string mapname, Graph::Node new_item=INVALID); + int changeNodeText (std::string mapname, Node new_item=INVALID); ///Callback for 'ViewZoomIn' action. virtual void zoomIn(); @@ -119,11 +119,9 @@ private: ///Deletes the given element. - void deleteItem(NodeIt); + void deleteItem(Node); ///Deletes the given element. - void deleteItem(EdgeIt); - ///Deletes the given element. - void deleteItem(Graph::Edge); + void deleteItem(Edge); private: @@ -166,9 +164,9 @@ ///1. we cannot query the item at he cursor as fast as it could not cause a Segmentation Fault ///2. we would like to handle only ony item per movement, therefore quering it is not a working solution Gnome::Canvas::Item * active_item, * target_item; - Graph::NodeIt active_node; - Graph::EdgeIt active_edge; - Graph::EdgeIt forming_edge; + Node active_node; + Edge active_edge; + Edge forming_edge; std::string nodemap_to_edit, edgemap_to_edit; diff -r a2dda876316f -r 9285f3777553 gui/map_win.cc --- a/gui/map_win.cc Thu Aug 18 12:22:44 2005 +0000 +++ b/gui/map_win.cc Thu Aug 18 13:33:49 2005 +0000 @@ -217,7 +217,7 @@ } }; -void MapWin::updateNode(Graph::Node node) +void MapWin::updateNode(Node node) { for(int i=0;i * >::iterator ems_it; for(ems_it=edgemap_storage.begin();ems_it!=edgemap_storage.end();ems_it++) diff -r a2dda876316f -r 9285f3777553 lemon/concept/graph.h --- a/lemon/concept/graph.h Thu Aug 18 12:22:44 2005 +0000 +++ b/lemon/concept/graph.h Thu Aug 18 13:33:49 2005 +0000 @@ -404,7 +404,7 @@ /// This constructor sets the iterator to the first edge of \c g. ///@param g the graph - EdgeIt(const StaticGraph& g) { } + EdgeIt(const StaticGraph& g) { ignore_unused_variable_warning(g); } /// Edge -> EdgeIt conversion /// Sets the iterator to the value of the trivial iterator \c e. diff -r a2dda876316f -r 9285f3777553 lemon/concept/path.h --- a/lemon/concept/path.h Thu Aug 18 12:22:44 2005 +0000 +++ b/lemon/concept/path.h Thu Aug 18 13:33:49 2005 +0000 @@ -24,6 +24,7 @@ #define LEMON_CONCEPT_PATH_H #include +#include namespace lemon { namespace concept { @@ -54,7 +55,9 @@ /// \param _g The graph in which the path is. /// - Path(const Graph &_g) {} + Path(const Graph &_g) { + ignore_unused_variable_warning(_g); + } /// Length of the path. int length() const {return 0;} diff -r a2dda876316f -r 9285f3777553 lemon/concept/undir_graph.h --- a/lemon/concept/undir_graph.h Thu Aug 18 12:22:44 2005 +0000 +++ b/lemon/concept/undir_graph.h Thu Aug 18 13:33:49 2005 +0000 @@ -557,7 +557,7 @@ /// This constructor sets the iterator to the first edge of \c g. ///@param g the graph - EdgeIt(const UndirGraph &g) { } + EdgeIt(const UndirGraph &g) { ignore_unused_variable_warning(g); } /// Edge -> EdgeIt conversion /// Sets the iterator to the value of the trivial iterator \c e. @@ -605,7 +605,10 @@ /// the node. ///@param n the node ///@param g the graph - OutEdgeIt(const UndirGraph& n, const Node& g) { } + OutEdgeIt(const UndirGraph& n, const Node& g) { + ignore_unused_variable_warning(n); + ignore_unused_variable_warning(g); + } /// Edge -> OutEdgeIt conversion /// Sets the iterator to the value of the trivial iterator. @@ -654,7 +657,10 @@ /// the node. ///@param n the node ///@param g the graph - InEdgeIt(const UndirGraph& g, const Node& n) { } + InEdgeIt(const UndirGraph& g, const Node& n) { + ignore_unused_variable_warning(n); + ignore_unused_variable_warning(g); + } /// Edge -> InEdgeIt conversion /// Sets the iterator to the value of the trivial iterator \c e. diff -r a2dda876316f -r 9285f3777553 lemon/full_graph.h --- a/lemon/full_graph.h Thu Aug 18 12:22:44 2005 +0000 +++ b/lemon/full_graph.h Thu Aug 18 13:33:49 2005 +0000 @@ -125,10 +125,10 @@ protected: int id; - Node(int _id) { id = _id;} + Node(int _id) : id(_id) {} public: Node() {} - Node (Invalid) { id = -1; } + Node (Invalid) : id(-1) {} bool operator==(const Node node) const {return id == node.id;} bool operator!=(const Node node) const {return id != node.id;} bool operator<(const Node node) const {return id < node.id;} @@ -260,12 +260,12 @@ Node source(Edge e) const { /// \todo we may do it faster - return ((int)sqrt((double)(1 + 8 * e.id)) + 1) / 2; + return Node(((int)sqrt((double)(1 + 8 * e.id)) + 1) / 2); } Node target(Edge e) const { int source = ((int)sqrt((double)(1 + 8 * e.id)) + 1) / 2;; - return e.id - (source) * (source - 1) / 2; + return Node(e.id - (source) * (source - 1) / 2); }