diff -r fd4b6f6d592a -r 1e3c69aa035b gui/graph_displayer_canvas.h --- a/gui/graph_displayer_canvas.h Wed Jun 01 23:30:13 2005 +0000 +++ b/gui/graph_displayer_canvas.h Wed Jun 01 23:33:26 2005 +0000 @@ -1,89 +1,89 @@ -// -*- C++ -*- // - -#ifndef GRAPH_DISPLAYER_CANVAS_H -#define GRAPH_DISPLAYER_CANVAS_H - -#include -#include -#include -#include - -///This class is the canvas, on which the graph can be drawn. -class GraphDisplayerCanvas : public Gnome::Canvas::CanvasAA -{ - typedef Gnome::Canvas::CanvasAA Parent; - -public: - GraphDisplayerCanvas(Graph &, CoordinatesMap &, MapStorage &); - virtual ~GraphDisplayerCanvas(); - - ///Changes the linewidth attribute according to the given map. - ///\param mapname is the name of the map which contains the new values - int changeLineWidth (std::string mapname); - - ///Changes the linecolor attribute according to the given map. - ///\param mapname is the name of the map which contains the new values - int changeColor (std::string mapname); - - ///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 changeText (std::string mapname); - - ///Callback for 'ViewZoomIn' action. - virtual void zoomIn(); - ///Callback for 'ViewZoomOut' action. - virtual void zoomOut(); - ///Callback for 'ViewZoomFit' action. - virtual void zoomFit(); - ///Callback for 'ViewZoom100' action. - virtual void zoom100(); - ///Sets the scroll region of the convas to the bounding box of the graph. - void updateScrollRegion(); - -protected: - - //maximizing, minimizing, restoring window, etc. - virtual bool on_expose_event(GdkEventExpose *); - -private: - - ///This function is responsible for the correct - ///reaction of any action happened in the territory - ///of the canvas - bool event_handler(GdkEvent* e, Node n); - - ///The graph, on which we work - Graph g; - - ///Map of nodes of graph - Graph::NodeMap nodesmap; - - ///Map of edges of graph - Graph::EdgeMap edgesmap; - - ///Map of texts to write on edges - Graph::EdgeMap edgetextmap; - - ///Group of graphical elements of displayed_graph - Gnome::Canvas::Group displayed_graph; - - ///Here we store the maps that can be displayed through properties. - MapStorage mapstorage; - - ///Indicates whether the button of mouse is pressed or not - bool isbutton; - - ///At this location was the mousebutton pressed. - ///It helps to calculate the distance of dragging. - double clicked_x, clicked_y; - - ///Remembers which Gnome::Canvas::Item was pressed. - ///this variable is needed, because - ///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; - - static const int zoom_step = 5; -}; - -#endif //GRAPH_DISPLAYER_CANVAS_H +// -*- C++ -*- // + +#ifndef GRAPH_DISPLAYER_CANVAS_H +#define GRAPH_DISPLAYER_CANVAS_H + +#include +#include +#include +#include + +///This class is the canvas, on which the graph can be drawn. +class GraphDisplayerCanvas : public Gnome::Canvas::CanvasAA +{ + typedef Gnome::Canvas::CanvasAA Parent; + +public: + GraphDisplayerCanvas(Graph &, CoordinatesMap &, MapStorage &); + virtual ~GraphDisplayerCanvas(); + + ///Changes the linewidth attribute according to the given map. + ///\param mapname is the name of the map which contains the new values + int changeLineWidth (std::string mapname); + + ///Changes the linecolor attribute according to the given map. + ///\param mapname is the name of the map which contains the new values + int changeColor (std::string mapname); + + ///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 changeText (std::string mapname); + + ///Callback for 'ViewZoomIn' action. + virtual void zoomIn(); + ///Callback for 'ViewZoomOut' action. + virtual void zoomOut(); + ///Callback for 'ViewZoomFit' action. + virtual void zoomFit(); + ///Callback for 'ViewZoom100' action. + virtual void zoom100(); + ///Sets the scroll region of the convas to the bounding box of the graph. + void updateScrollRegion(); + +protected: + + //maximizing, minimizing, restoring window, etc. + virtual bool on_expose_event(GdkEventExpose *); + +private: + + ///This function is responsible for the correct + ///reaction of any action happened in the territory + ///of the canvas + bool event_handler(GdkEvent* e, Node n); + + ///The graph, on which we work + Graph g; + + ///Map of nodes of graph + Graph::NodeMap nodesmap; + + ///Map of edges of graph + Graph::EdgeMap edgesmap; + + ///Map of texts to write on edges + Graph::EdgeMap edgetextmap; + + ///Group of graphical elements of displayed_graph + Gnome::Canvas::Group displayed_graph; + + ///Here we store the maps that can be displayed through properties. + MapStorage mapstorage; + + ///Indicates whether the button of mouse is pressed or not + bool isbutton; + + ///At this location was the mousebutton pressed. + ///It helps to calculate the distance of dragging. + double clicked_x, clicked_y; + + ///Remembers which Gnome::Canvas::Item was pressed. + ///this variable is needed, because + ///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; + + static const int zoom_step = 5; +}; + +#endif //GRAPH_DISPLAYER_CANVAS_H