gui/graph_displayer_canvas.cc
changeset 1849 a4d1362397fe
parent 1837 8dd6160ff699
child 1860 27a9a75b957b
     1.1 --- a/gui/graph_displayer_canvas.cc	Mon Dec 05 17:03:58 2005 +0000
     1.2 +++ b/gui/graph_displayer_canvas.cc	Tue Dec 06 10:53:38 2005 +0000
     1.3 @@ -1,11 +1,11 @@
     1.4  #include "graph_displayer_canvas.h"
     1.5  #include <cmath>
     1.6  
     1.7 -GraphDisplayerCanvas::GraphDisplayerCanvas(MainWin & mainw) :
     1.8 +GraphDisplayerCanvas::GraphDisplayerCanvas(NoteBookTab & mainw) :
     1.9    nodesmap(mainw.mapstorage.graph), edgesmap(mainw.mapstorage.graph), edgetextmap(mainw.mapstorage.graph),
    1.10    nodetextmap(mainw.mapstorage.graph), displayed_graph(*(root()), 0, 0),
    1.11    isbutton(0), active_item(NULL), target_item(NULL), nodemap_to_edit(""),
    1.12 -  edgemap_to_edit(""), mainwin(mainw)
    1.13 +  edgemap_to_edit(""), mytab(mainw)
    1.14  {
    1.15    //base event handler is move tool
    1.16    actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::moveEventHandler), false);
    1.17 @@ -18,13 +18,13 @@
    1.18  
    1.19  GraphDisplayerCanvas::~GraphDisplayerCanvas()
    1.20  {
    1.21 -  for (NodeIt n((mainwin.mapstorage).graph); n != INVALID; ++n)
    1.22 +  for (NodeIt n((mytab.mapstorage).graph); n != INVALID; ++n)
    1.23      {
    1.24        delete nodesmap[n];
    1.25        delete nodetextmap[n];
    1.26      }
    1.27    
    1.28 -  for (EdgeIt e((mainwin.mapstorage).graph); e != INVALID; ++e)
    1.29 +  for (EdgeIt e((mytab.mapstorage).graph); e != INVALID; ++e)
    1.30      {
    1.31        delete edgesmap[e];
    1.32        delete edgetextmap[e];
    1.33 @@ -63,11 +63,11 @@
    1.34  {
    1.35    dummy=dummy;
    1.36  
    1.37 -  std::string mapname=mainwin.getActiveNodeMap(prop);
    1.38 +  std::string mapname=mytab.getActiveNodeMap(prop);
    1.39  
    1.40    if(mapname!="")
    1.41      {
    1.42 -      if( ( ((mainwin.mapstorage).nodemap_storage).find(mapname) != ((mainwin.mapstorage).nodemap_storage).end() ) )
    1.43 +      if( ( ((mytab.mapstorage).nodemap_storage).find(mapname) != ((mytab.mapstorage).nodemap_storage).end() ) )
    1.44  	{
    1.45  	  switch(prop)
    1.46  	    {
    1.47 @@ -110,11 +110,11 @@
    1.48  {
    1.49    dummy=dummy;
    1.50  
    1.51 -  std::string mapname=mainwin.getActiveEdgeMap(prop);
    1.52 +  std::string mapname=mytab.getActiveEdgeMap(prop);
    1.53  
    1.54    if(mapname!="")
    1.55      {
    1.56 -      if( ( ((mainwin.mapstorage).edgemap_storage).find(mapname) != ((mainwin.mapstorage).edgemap_storage).end() ) )
    1.57 +      if( ( ((mytab.mapstorage).edgemap_storage).find(mapname) != ((mytab.mapstorage).edgemap_storage).end() ) )
    1.58  	{
    1.59  	  switch(prop)
    1.60  	    {
    1.61 @@ -155,18 +155,18 @@
    1.62  {
    1.63    //first edges are drawn, to hide joining with nodes later
    1.64  
    1.65 -  for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
    1.66 +  for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
    1.67    {
    1.68  
    1.69      //drawing green lines, coordinates are from mapstorage.coords
    1.70  
    1.71      Gnome::Canvas::Points coos;
    1.72      coos.push_back(Gnome::Art::Point(
    1.73 -          (mainwin.mapstorage).coords[(mainwin.mapstorage).graph.source(i)].x,
    1.74 -          (mainwin.mapstorage).coords[(mainwin.mapstorage).graph.source(i)].y));
    1.75 +          (mytab.mapstorage).coords[(mytab.mapstorage).graph.source(i)].x,
    1.76 +          (mytab.mapstorage).coords[(mytab.mapstorage).graph.source(i)].y));
    1.77      coos.push_back(Gnome::Art::Point(
    1.78 -          (mainwin.mapstorage).coords[(mainwin.mapstorage).graph.target(i)].x,
    1.79 -          (mainwin.mapstorage).coords[(mainwin.mapstorage).graph.target(i)].y));
    1.80 +          (mytab.mapstorage).coords[(mytab.mapstorage).graph.target(i)].x,
    1.81 +          (mytab.mapstorage).coords[(mytab.mapstorage).graph.target(i)].y));
    1.82      
    1.83      edgesmap[i]=new BrokenEdge(displayed_graph, coos, *this);
    1.84      *(edgesmap[i]) << Gnome::Canvas::Properties::fill_color("green");
    1.85 @@ -186,16 +186,16 @@
    1.86  
    1.87    //afterwards nodes come to be drawn
    1.88  
    1.89 -  for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
    1.90 +  for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
    1.91    {
    1.92      //drawing bule nodes, with black line around them
    1.93  
    1.94      nodesmap[i]=new Gnome::Canvas::Ellipse(
    1.95          displayed_graph,
    1.96 -        (mainwin.mapstorage).coords[i].x-20,
    1.97 -        (mainwin.mapstorage).coords[i].y-20,
    1.98 -        (mainwin.mapstorage).coords[i].x+20,
    1.99 -        (mainwin.mapstorage).coords[i].y+20);
   1.100 +        (mytab.mapstorage).coords[i].x-20,
   1.101 +        (mytab.mapstorage).coords[i].y-20,
   1.102 +        (mytab.mapstorage).coords[i].x+20,
   1.103 +        (mytab.mapstorage).coords[i].y+20);
   1.104      *(nodesmap[i]) << Gnome::Canvas::Properties::fill_color("blue");
   1.105      *(nodesmap[i]) << Gnome::Canvas::Properties::outline_color("black");
   1.106      nodesmap[i]->raise_to_top();
   1.107 @@ -203,8 +203,8 @@
   1.108      //initializing edge-text as well, to empty string
   1.109  
   1.110      xy<double> text_pos(
   1.111 -        ((mainwin.mapstorage).coords[i].x+node_property_defaults[N_RADIUS]+5),
   1.112 -        ((mainwin.mapstorage).coords[i].y+node_property_defaults[N_RADIUS]+5));
   1.113 +        ((mytab.mapstorage).coords[i].x+node_property_defaults[N_RADIUS]+5),
   1.114 +        ((mytab.mapstorage).coords[i].y+node_property_defaults[N_RADIUS]+5));
   1.115  
   1.116      nodetextmap[i]=new Gnome::Canvas::Text(displayed_graph,
   1.117          text_pos.x, text_pos.y, "");
   1.118 @@ -222,13 +222,13 @@
   1.119    active_edge=INVALID;
   1.120    forming_edge=INVALID;
   1.121  
   1.122 -  for (NodeIt n((mainwin.mapstorage).graph); n != INVALID; ++n)
   1.123 +  for (NodeIt n((mytab.mapstorage).graph); n != INVALID; ++n)
   1.124    {
   1.125      delete nodesmap[n];
   1.126      delete nodetextmap[n];
   1.127    }
   1.128  
   1.129 -  for (EdgeIt e((mainwin.mapstorage).graph); e != INVALID; ++e)
   1.130 +  for (EdgeIt e((mytab.mapstorage).graph); e != INVALID; ++e)
   1.131    {
   1.132      delete edgesmap[e];
   1.133      delete edgetextmap[e];