Notebook style is provided. Without opportunity to close tabs. :-) But with all other necessary things (I think). gui
authorhegyi
Tue, 06 Dec 2005 10:53:38 +0000
branchgui
changeset 96e664d8aa3f72
parent 95 628c0b383d2f
child 97 23f0afd1a323
Notebook style is provided. Without opportunity to close tabs. :-) But with all other necessary things (I think).
Makefile.am
graph-displayer.cc
graph_displayer_canvas-edge.cc
graph_displayer_canvas-event.cc
graph_displayer_canvas-node.cc
graph_displayer_canvas.cc
graph_displayer_canvas.h
main_win.cc
main_win.h
map_win.cc
map_win.h
nbtab.cc
nbtab.h
new_map_win.cc
new_map_win.h
     1.1 --- a/Makefile.am	Wed Nov 30 13:24:23 2005 +0000
     1.2 +++ b/Makefile.am	Tue Dec 06 10:53:38 2005 +0000
     1.3 @@ -8,14 +8,14 @@
     1.4  
     1.5  glemon_SOURCES = \
     1.6  	all_include.h \
     1.7 +	gdc-broken_edge.cc \
     1.8  	graph_displayer_canvas.cc \
     1.9 +	graph_displayer_canvas.h \
    1.10  	graph_displayer_canvas-edge.cc \
    1.11 +	graph_displayer_canvas-event.cc \
    1.12  	graph_displayer_canvas-node.cc \
    1.13 -	graph_displayer_canvas-event.cc \
    1.14  	graph_displayer_canvas-zoom.cc \
    1.15 -	graph_displayer_canvas.h \
    1.16  	graph-displayer.cc \
    1.17 -	gdc-broken_edge.cc \
    1.18  	main_win.cc \
    1.19  	main_win.h \
    1.20  	mapstorage.cc \
    1.21 @@ -23,6 +23,8 @@
    1.22  	map_win.cc \
    1.23  	map_win.h \
    1.24  	mw-mapselector.cc \
    1.25 +	nbtab.h \
    1.26 +	nbtab.cc \
    1.27  	new_map_win.cc \
    1.28  	new_map_win.h \
    1.29  	xymap.h \
     2.1 --- a/graph-displayer.cc	Wed Nov 30 13:24:23 2005 +0000
     2.2 +++ b/graph-displayer.cc	Tue Dec 06 10:53:38 2005 +0000
     2.3 @@ -61,14 +61,14 @@
     2.4    Gnome::Canvas::init();
     2.5    Gtk::Main app(argc, argv);
     2.6  
     2.7 -  MainWin mainwin;
     2.8 +  MainWin mytab;
     2.9  
    2.10    if ((argc == 2) && (Glib::file_test(argv[1], Glib::FILE_TEST_IS_REGULAR)))
    2.11 -  {
    2.12 -    mainwin.readFile(argv[1]);
    2.13 -  }
    2.14 +    {
    2.15 +      mytab.readFile(argv[1]);
    2.16 +    }
    2.17    
    2.18 -  app.run(mainwin);
    2.19 +  app.run(mytab);
    2.20  
    2.21    return 0;
    2.22  }
     3.1 --- a/graph_displayer_canvas-edge.cc	Wed Nov 30 13:24:23 2005 +0000
     3.2 +++ b/graph_displayer_canvas-edge.cc	Tue Dec 06 10:53:38 2005 +0000
     3.3 @@ -8,11 +8,11 @@
     3.4  
     3.5    min=edge_property_defaults[E_WIDTH];
     3.6    max=edge_property_defaults[E_WIDTH];
     3.7 -  Graph::EdgeMap<double> actual_map((mainwin.mapstorage).graph,edge_property_defaults[E_WIDTH]);
     3.8 +  Graph::EdgeMap<double> actual_map((mytab.mapstorage).graph,edge_property_defaults[E_WIDTH]);
     3.9    
    3.10    if(edge==INVALID)
    3.11      {
    3.12 -      for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
    3.13 +      for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
    3.14  	{
    3.15  	  double v=fabs(actual_map[i]);
    3.16  	  int w;
    3.17 @@ -44,13 +44,13 @@
    3.18    Graph::EdgeMap<double> * actual_map;
    3.19    double min, max;
    3.20  
    3.21 -  min=(mainwin.mapstorage).minOfEdgeMap(mapname);
    3.22 -  max=(mainwin.mapstorage).maxOfEdgeMap(mapname);
    3.23 -  actual_map=((mainwin.mapstorage).edgemap_storage)[mapname];
    3.24 +  min=(mytab.mapstorage).minOfEdgeMap(mapname);
    3.25 +  max=(mytab.mapstorage).maxOfEdgeMap(mapname);
    3.26 +  actual_map=((mytab.mapstorage).edgemap_storage)[mapname];
    3.27  
    3.28    if(edge==INVALID)
    3.29      {
    3.30 -      for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
    3.31 +      for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
    3.32  	{
    3.33  	  double v=fabs((*actual_map)[i]);
    3.34  	  int w;
    3.35 @@ -83,16 +83,16 @@
    3.36    //the minimum of the nodemap to the range of
    3.37    //green in RGB
    3.38    Graph::EdgeMap<double> * actual_map;
    3.39 -  actual_map=((mainwin.mapstorage).edgemap_storage)[mapname];
    3.40 +  actual_map=((mytab.mapstorage).edgemap_storage)[mapname];
    3.41  
    3.42    double max, min;
    3.43  
    3.44 -  max=(mainwin.mapstorage).maxOfEdgeMap(mapname);
    3.45 -  min=(mainwin.mapstorage).minOfEdgeMap(mapname);
    3.46 +  max=(mytab.mapstorage).maxOfEdgeMap(mapname);
    3.47 +  min=(mytab.mapstorage).minOfEdgeMap(mapname);
    3.48  
    3.49    if(edge==INVALID)
    3.50      {
    3.51 -      for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
    3.52 +      for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
    3.53  	{
    3.54  	  double w=(*actual_map)[i];
    3.55  
    3.56 @@ -134,7 +134,7 @@
    3.57    //function maps the range of the maximum and
    3.58    //the minimum of the nodemap to the range of
    3.59    //green in RGB
    3.60 -  Graph::EdgeMap<double> actual_map((mainwin.mapstorage).graph,edge_property_defaults[E_COLOR]);
    3.61 +  Graph::EdgeMap<double> actual_map((mytab.mapstorage).graph,edge_property_defaults[E_COLOR]);
    3.62  
    3.63    double max, min;
    3.64  
    3.65 @@ -143,7 +143,7 @@
    3.66  
    3.67    if(edge==INVALID)
    3.68      {
    3.69 -      for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
    3.70 +      for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
    3.71  	{
    3.72  	  double w=actual_map[i];
    3.73  
    3.74 @@ -188,10 +188,10 @@
    3.75    
    3.76    if(edge==INVALID)
    3.77      {
    3.78 -      for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
    3.79 +      for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
    3.80  	{
    3.81  	  edgemap_to_edit=mapname;
    3.82 -	  double number=(*((mainwin.mapstorage).edgemap_storage)[mapname])[i];
    3.83 +	  double number=(*((mytab.mapstorage).edgemap_storage)[mapname])[i];
    3.84  	  
    3.85  	  std::ostringstream ostr;
    3.86  	  ostr << number;
    3.87 @@ -202,7 +202,7 @@
    3.88      }
    3.89    else
    3.90      {
    3.91 -	  double number=(*((mainwin.mapstorage).edgemap_storage)[mapname])[edge];
    3.92 +	  double number=(*((mytab.mapstorage).edgemap_storage)[mapname])[edge];
    3.93  
    3.94  	  std::ostringstream ostr;
    3.95  	  ostr << number;
    3.96 @@ -223,7 +223,7 @@
    3.97    
    3.98    if(edge==INVALID)
    3.99      {
   3.100 -      for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
   3.101 +      for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
   3.102  	{
   3.103  	  edgemap_to_edit="";
   3.104  	  edgetextmap[i]->property_text().set_value("");
     4.1 --- a/graph_displayer_canvas-event.cc	Wed Nov 30 13:24:23 2005 +0000
     4.2 +++ b/graph_displayer_canvas-event.cc	Tue Dec 06 10:53:38 2005 +0000
     4.3 @@ -94,7 +94,7 @@
     4.4  
     4.5        active_item=(get_item_at(clicked_x, clicked_y));
     4.6        active_node=INVALID;
     4.7 -      for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
     4.8 +      for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
     4.9  	{
    4.10  	  if(nodesmap[i]==active_item)
    4.11  	    {
    4.12 @@ -125,7 +125,7 @@
    4.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
    4.14        if(active_node!=INVALID)
    4.15        {
    4.16 -        (mainwin.mapstorage).modified = true;
    4.17 +        (mytab.mapstorage).modified = true;
    4.18  
    4.19  	//new coordinates will be the old values,
    4.20  	//because the item will be moved to the
    4.21 @@ -144,52 +144,52 @@
    4.22  	nodetextmap[active_node]->move(dx, dy);
    4.23  
    4.24          // the new coordinates of the centre of the node 
    4.25 -        double coord_x = new_x - (clicked_x - (mainwin.mapstorage).coords[active_node].x);
    4.26 -        double coord_y = new_y - (clicked_y - (mainwin.mapstorage).coords[active_node].y);
    4.27 +        double coord_x = new_x - (clicked_x - (mytab.mapstorage).coords[active_node].x);
    4.28 +        double coord_y = new_y - (clicked_y - (mytab.mapstorage).coords[active_node].y);
    4.29  
    4.30          clicked_x=new_x;
    4.31          clicked_y=new_y;
    4.32  
    4.33          // write back the new coordinates to the coords map
    4.34 -        (mainwin.mapstorage).coords.set(active_node, xy<double>(coord_x, coord_y));
    4.35 +        (mytab.mapstorage).coords.set(active_node, xy<double>(coord_x, coord_y));
    4.36  
    4.37          // reposition the coordinates text
    4.38          std::ostringstream ostr;
    4.39          ostr << "(" <<
    4.40 -          (mainwin.mapstorage).coords[active_node].x << ", " <<
    4.41 -          (mainwin.mapstorage).coords[active_node].y << ")";
    4.42 +          (mytab.mapstorage).coords[active_node].x << ", " <<
    4.43 +          (mytab.mapstorage).coords[active_node].y << ")";
    4.44          double radius =
    4.45            (nodesmap[active_node]->property_x2().get_value() -
    4.46            nodesmap[active_node]->property_x1().get_value()) / 2.0;
    4.47          if (coord_text)
    4.48          {
    4.49            coord_text->property_text().set_value(ostr.str());
    4.50 -          coord_text->property_x().set_value((mainwin.mapstorage).coords[active_node].x +
    4.51 +          coord_text->property_x().set_value((mytab.mapstorage).coords[active_node].x +
    4.52                radius);
    4.53 -          coord_text->property_y().set_value((mainwin.mapstorage).coords[active_node].y -
    4.54 +          coord_text->property_y().set_value((mytab.mapstorage).coords[active_node].y -
    4.55                radius);
    4.56          }
    4.57          else
    4.58          {
    4.59            coord_text = new Gnome::Canvas::Text(
    4.60                displayed_graph,
    4.61 -              (mainwin.mapstorage).coords[active_node].x + radius,
    4.62 -              (mainwin.mapstorage).coords[active_node].y - radius,
    4.63 +              (mytab.mapstorage).coords[active_node].x + radius,
    4.64 +              (mytab.mapstorage).coords[active_node].y - radius,
    4.65                ostr.str());
    4.66            coord_text->property_fill_color().set_value("black");
    4.67            coord_text->property_anchor().set_value(Gtk::ANCHOR_SOUTH_WEST);
    4.68          }
    4.69  
    4.70  	//all the edges connected to the moved point has to be redrawn
    4.71 -        for(OutEdgeIt ei((mainwin.mapstorage).graph,active_node);ei!=INVALID;++ei)
    4.72 +        for(OutEdgeIt ei((mytab.mapstorage).graph,active_node);ei!=INVALID;++ei)
    4.73          {
    4.74              Gnome::Canvas::Points coos;
    4.75              double x1, x2, y1, y2;
    4.76  
    4.77 -            nodesmap[(mainwin.mapstorage).graph.source(ei)]->get_bounds(x1, y1, x2, y2);
    4.78 +            nodesmap[(mytab.mapstorage).graph.source(ei)]->get_bounds(x1, y1, x2, y2);
    4.79              coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
    4.80  
    4.81 -            nodesmap[(mainwin.mapstorage).graph.target(ei)]->get_bounds(x1, y1, x2, y2);
    4.82 +            nodesmap[(mytab.mapstorage).graph.target(ei)]->get_bounds(x1, y1, x2, y2);
    4.83              coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
    4.84  
    4.85  	    if(isbutton==3)
    4.86 @@ -208,15 +208,15 @@
    4.87  	    edgetextmap[ei]->property_y().set_value(text_pos.y);
    4.88          }
    4.89  
    4.90 -        for(InEdgeIt ei((mainwin.mapstorage).graph,active_node);ei!=INVALID;++ei)
    4.91 +        for(InEdgeIt ei((mytab.mapstorage).graph,active_node);ei!=INVALID;++ei)
    4.92          {
    4.93              Gnome::Canvas::Points coos;
    4.94              double x1, x2, y1, y2;
    4.95  
    4.96 -            nodesmap[(mainwin.mapstorage).graph.source(ei)]->get_bounds(x1, y1, x2, y2);
    4.97 +            nodesmap[(mytab.mapstorage).graph.source(ei)]->get_bounds(x1, y1, x2, y2);
    4.98              coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
    4.99  
   4.100 -            nodesmap[(mainwin.mapstorage).graph.target(ei)]->get_bounds(x1, y1, x2, y2);
   4.101 +            nodesmap[(mytab.mapstorage).graph.target(ei)]->get_bounds(x1, y1, x2, y2);
   4.102              coos.push_back(Gnome::Art::Point((x1+x2)/2,(y1+y2)/2));
   4.103  
   4.104  	    if(isbutton==3)
   4.105 @@ -256,33 +256,33 @@
   4.106        }
   4.107  
   4.108      case GDK_BUTTON_RELEASE:
   4.109 -      (mainwin.mapstorage).modified = true;
   4.110 +      (mytab.mapstorage).modified = true;
   4.111  
   4.112        isbutton=1;
   4.113  
   4.114 -      active_node=(mainwin.mapstorage).graph.addNode();
   4.115 +      active_node=(mytab.mapstorage).graph.addNode();
   4.116  
   4.117        //initiating values corresponding to new node in maps
   4.118  
   4.119        window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
   4.120  
   4.121        // update coordinates
   4.122 -      (mainwin.mapstorage).coords.set(active_node, xy<double>(clicked_x, clicked_y));
   4.123 +      (mytab.mapstorage).coords.set(active_node, xy<double>(clicked_x, clicked_y));
   4.124  
   4.125        // update all other maps
   4.126        for (std::map<std::string, Graph::NodeMap<double>*>::const_iterator it =
   4.127 -          (mainwin.mapstorage).nodemap_storage.begin(); it !=
   4.128 -          (mainwin.mapstorage).nodemap_storage.end(); ++it)
   4.129 +          (mytab.mapstorage).nodemap_storage.begin(); it !=
   4.130 +          (mytab.mapstorage).nodemap_storage.end(); ++it)
   4.131        {
   4.132          if ((it->first != "coordinates_x") &&
   4.133              (it->first != "coordinates_y"))
   4.134          {
   4.135            (*(it->second))[active_node] =
   4.136 -            (mainwin.mapstorage).nodemap_default[it->first];
   4.137 +            (mytab.mapstorage).nodemap_default[it->first];
   4.138          }
   4.139        }
   4.140        // increment the id map's default value
   4.141 -      (mainwin.mapstorage).nodemap_default["id"] += 1.0;
   4.142 +      (mytab.mapstorage).nodemap_default["id"] += 1.0;
   4.143  
   4.144        nodesmap[active_node]=new Gnome::Canvas::Ellipse(displayed_graph,
   4.145            clicked_x-20, clicked_y-20, clicked_x+20, clicked_y+20);
   4.146 @@ -332,7 +332,7 @@
   4.147  
   4.148            active_item=(get_item_at(clicked_x, clicked_y));
   4.149            active_node=INVALID;
   4.150 -          for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
   4.151 +          for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
   4.152            {
   4.153              if(nodesmap[i]==active_item)
   4.154              {
   4.155 @@ -361,7 +361,7 @@
   4.156            window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
   4.157            target_item=(get_item_at(clicked_x, clicked_y));
   4.158            Node target_node=INVALID;
   4.159 -          for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
   4.160 +          for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
   4.161            {
   4.162              if(nodesmap[i]==target_item)
   4.163              {
   4.164 @@ -373,26 +373,26 @@
   4.165            {
   4.166              if(target_node!=active_node)		
   4.167              {
   4.168 -              (mainwin.mapstorage).modified = true;
   4.169 +              (mytab.mapstorage).modified = true;
   4.170  
   4.171                *(nodesmap[target_node]) <<
   4.172                  Gnome::Canvas::Properties::fill_color("red");
   4.173  
   4.174                //creating new edge
   4.175 -              active_edge=(mainwin.mapstorage).graph.addEdge(active_node,
   4.176 +              active_edge=(mytab.mapstorage).graph.addEdge(active_node,
   4.177                    target_node);
   4.178  
   4.179                // update maps
   4.180                for (std::map<std::string,
   4.181                    Graph::EdgeMap<double>*>::const_iterator it =
   4.182 -                  (mainwin.mapstorage).edgemap_storage.begin(); it !=
   4.183 -                  (mainwin.mapstorage).edgemap_storage.end(); ++it)
   4.184 +                  (mytab.mapstorage).edgemap_storage.begin(); it !=
   4.185 +                  (mytab.mapstorage).edgemap_storage.end(); ++it)
   4.186                {
   4.187                  (*(it->second))[active_edge] =
   4.188 -                  (mainwin.mapstorage).edgemap_default[it->first];
   4.189 +                  (mytab.mapstorage).edgemap_default[it->first];
   4.190                }
   4.191                // increment the id map's default value
   4.192 -              (mainwin.mapstorage).edgemap_default["id"] += 1.0;
   4.193 +              (mytab.mapstorage).edgemap_default["id"] += 1.0;
   4.194  
   4.195                //calculating coordinates of new edge
   4.196                Gnome::Canvas::Points coos;
   4.197 @@ -480,7 +480,7 @@
   4.198        active_node=INVALID;
   4.199        active_edge=INVALID;
   4.200        //was it a node?
   4.201 -      for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
   4.202 +      for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
   4.203  	{
   4.204  	  if(nodesmap[i]==active_item)
   4.205  	    {
   4.206 @@ -490,7 +490,7 @@
   4.207        //or was it an edge?
   4.208        if(active_node==INVALID)
   4.209  	{
   4.210 -	  for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
   4.211 +	  for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
   4.212  	    {
   4.213  	      if(edgesmap[i]==active_item)
   4.214  		{
   4.215 @@ -516,16 +516,16 @@
   4.216  	      //a node was found
   4.217  	      if(active_node!=INVALID)
   4.218  		{
   4.219 -                  (mainwin.mapstorage).modified = true;
   4.220 +                  (mytab.mapstorage).modified = true;
   4.221  
   4.222  		  std::set<Graph::Edge> edges_to_delete;
   4.223  
   4.224 -		  for(OutEdgeIt e((mainwin.mapstorage).graph,active_node);e!=INVALID;++e)
   4.225 +		  for(OutEdgeIt e((mytab.mapstorage).graph,active_node);e!=INVALID;++e)
   4.226  		    {
   4.227  		      edges_to_delete.insert(e);
   4.228  		    }
   4.229  		  
   4.230 -		  for(InEdgeIt e((mainwin.mapstorage).graph,active_node);e!=INVALID;++e)
   4.231 +		  for(InEdgeIt e((mytab.mapstorage).graph,active_node);e!=INVALID;++e)
   4.232  		    {
   4.233  		      edges_to_delete.insert(e);
   4.234  		    }
   4.235 @@ -589,7 +589,7 @@
   4.236            active_item=(get_item_at(clicked_x, clicked_y));
   4.237  
   4.238            //find the activated item between texts
   4.239 -          for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
   4.240 +          for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
   4.241            {
   4.242              //at the same time only one can be active
   4.243              if(edgetextmap[i]==active_item)
   4.244 @@ -601,7 +601,7 @@
   4.245            //if it was not between texts, search for it between edges
   4.246            if(clicked_edge==INVALID)
   4.247            {
   4.248 -            for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
   4.249 +            for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
   4.250              {
   4.251                //at the same time only one can be active
   4.252                if((edgesmap[i]==active_item)||(edgetextmap[i]==active_item))
   4.253 @@ -624,7 +624,7 @@
   4.254                active_edge=clicked_edge;
   4.255  
   4.256                //create a dialog
   4.257 -              Gtk::Dialog dialog("Edit value", mainwin, true);
   4.258 +              Gtk::Dialog dialog("Edit value", true);
   4.259                dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
   4.260                dialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_ACCEPT);
   4.261                Gtk::VBox* vbox = dialog.get_vbox();
   4.262 @@ -641,7 +641,7 @@
   4.263                    break;
   4.264                  case Gtk::RESPONSE_ACCEPT:
   4.265                    double new_value = spin.get_value();
   4.266 -                  (*(mainwin.mapstorage).edgemap_storage[edgemap_to_edit])[active_edge] =
   4.267 +                  (*(mytab.mapstorage).edgemap_storage[edgemap_to_edit])[active_edge] =
   4.268                      new_value;
   4.269                    std::ostringstream ostr;
   4.270                    ostr << new_value;
   4.271 @@ -677,7 +677,7 @@
   4.272            active_item=(get_item_at(clicked_x, clicked_y));
   4.273  
   4.274            //find the activated item between texts
   4.275 -          for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
   4.276 +          for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
   4.277            {
   4.278              //at the same time only one can be active
   4.279              if(nodetextmap[i]==active_item)
   4.280 @@ -689,7 +689,7 @@
   4.281            //if there was not, search for it between nodes
   4.282            if(clicked_node==INVALID)
   4.283            {
   4.284 -            for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
   4.285 +            for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
   4.286              {
   4.287                //at the same time only one can be active
   4.288                if(nodesmap[i]==active_item)
   4.289 @@ -712,7 +712,7 @@
   4.290                active_node=clicked_node;
   4.291  
   4.292                //create a dialog
   4.293 -              Gtk::Dialog dialog("Edit value", mainwin, true);
   4.294 +              Gtk::Dialog dialog("Edit value", true);
   4.295                dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
   4.296                dialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_ACCEPT);
   4.297                Gtk::VBox* vbox = dialog.get_vbox();
   4.298 @@ -729,7 +729,7 @@
   4.299                    break;
   4.300                  case Gtk::RESPONSE_ACCEPT:
   4.301                    double new_value = spin.get_value();
   4.302 -                  (*(mainwin.mapstorage).nodemap_storage[nodemap_to_edit])[active_node] =
   4.303 +                  (*(mytab.mapstorage).nodemap_storage[nodemap_to_edit])[active_node] =
   4.304                      new_value;
   4.305                    std::ostringstream ostr;
   4.306                    ostr << new_value;
   4.307 @@ -754,14 +754,14 @@
   4.308  {
   4.309    delete(nodetextmap[node_to_delete]);
   4.310    delete(nodesmap[node_to_delete]);
   4.311 -  (mainwin.mapstorage).graph.erase(node_to_delete);
   4.312 +  (mytab.mapstorage).graph.erase(node_to_delete);
   4.313  }
   4.314  
   4.315  void GraphDisplayerCanvas::deleteItem(Edge edge_to_delete)
   4.316  {
   4.317    delete(edgetextmap[edge_to_delete]);
   4.318    delete(edgesmap[edge_to_delete]);
   4.319 -  (mainwin.mapstorage).graph.erase(edge_to_delete);
   4.320 +  (mytab.mapstorage).graph.erase(edge_to_delete);
   4.321  }
   4.322  
   4.323  void GraphDisplayerCanvas::textReposition(xy<double> new_place)
   4.324 @@ -781,7 +781,7 @@
   4.325  	}
   4.326        else
   4.327  	{
   4.328 -	  for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
   4.329 +	  for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
   4.330  	    {
   4.331  	      if(edgesmap[i]==active_bre)
   4.332  		{
   4.333 @@ -807,18 +807,18 @@
   4.334  int GraphDisplayerCanvas::addNewEdgeMap(double default_value, std::string mapname)
   4.335  {
   4.336    //create the new map
   4.337 -  Graph::EdgeMap<double> * emptr=new Graph::EdgeMap<double> ((mainwin.mapstorage).graph, default_value);
   4.338 +  Graph::EdgeMap<double> * emptr=new Graph::EdgeMap<double> ((mytab.mapstorage).graph, default_value);
   4.339  
   4.340    //if addition was not successful addEdgeMap returns one.
   4.341    //cause can be that there is already a map named like the new one
   4.342 -  if((mainwin.mapstorage).addEdgeMap(mapname,emptr, default_value))
   4.343 +  if((mytab.mapstorage).addEdgeMap(mapname,emptr, default_value))
   4.344      {
   4.345        return 1;
   4.346      }
   4.347  
   4.348  
   4.349    //add it to the list of the displayable maps
   4.350 -  mainwin.registerNewEdgeMap(mapname);
   4.351 +  mytab.registerNewEdgeMap(mapname);
   4.352  
   4.353    //display it
   4.354    changeEdgeText(mapname);
   4.355 @@ -829,17 +829,17 @@
   4.356  int GraphDisplayerCanvas::addNewNodeMap(double default_value, std::string mapname)
   4.357  {
   4.358    //create the new map
   4.359 -  Graph::NodeMap<double> * emptr=new Graph::NodeMap<double> ((mainwin.mapstorage).graph,default_value);
   4.360 +  Graph::NodeMap<double> * emptr=new Graph::NodeMap<double> ((mytab.mapstorage).graph,default_value);
   4.361  
   4.362    //if addition was not successful addNodeMap returns one.
   4.363    //cause can be that there is already a map named like the new one
   4.364 -  if((mainwin.mapstorage).addNodeMap(mapname,emptr, default_value))
   4.365 +  if((mytab.mapstorage).addNodeMap(mapname,emptr, default_value))
   4.366      {
   4.367        return 1;
   4.368      }
   4.369  
   4.370    //add it to the list of the displayable maps
   4.371 -  mainwin.registerNewNodeMap(mapname);
   4.372 +  mytab.registerNewNodeMap(mapname);
   4.373  
   4.374    //display it
   4.375    changeNodeText(mapname);
     5.1 --- a/graph_displayer_canvas-node.cc	Wed Nov 30 13:24:23 2005 +0000
     5.2 +++ b/graph_displayer_canvas-node.cc	Tue Dec 06 10:53:38 2005 +0000
     5.3 @@ -6,13 +6,13 @@
     5.4  {
     5.5    Graph::NodeMap<double> * actual_map;
     5.6    double min, max;
     5.7 -  min=(mainwin.mapstorage).minOfNodeMap(mapname);
     5.8 -  max=(mainwin.mapstorage).maxOfNodeMap(mapname);
     5.9 -  actual_map=((mainwin.mapstorage).nodemap_storage)[mapname];
    5.10 +  min=(mytab.mapstorage).minOfNodeMap(mapname);
    5.11 +  max=(mytab.mapstorage).maxOfNodeMap(mapname);
    5.12 +  actual_map=((mytab.mapstorage).nodemap_storage)[mapname];
    5.13  
    5.14    if(node==INVALID)
    5.15      {
    5.16 -      for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
    5.17 +      for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
    5.18  	{
    5.19  	  double v=fabs((*actual_map)[i]);
    5.20  	  int w;
    5.21 @@ -64,11 +64,11 @@
    5.22    double min, max;
    5.23    min=node_property_defaults[N_RADIUS];
    5.24    max=node_property_defaults[N_RADIUS];
    5.25 -  Graph::NodeMap<double> actual_map((mainwin.mapstorage).graph,node_property_defaults[N_RADIUS]);
    5.26 +  Graph::NodeMap<double> actual_map((mytab.mapstorage).graph,node_property_defaults[N_RADIUS]);
    5.27    
    5.28    if(node==INVALID)
    5.29      {
    5.30 -      for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
    5.31 +      for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
    5.32  	{
    5.33  	  double v=fabs(actual_map[i]);
    5.34  	  int w;
    5.35 @@ -123,17 +123,17 @@
    5.36    //green in RGB
    5.37  
    5.38    Graph::NodeMap<double> * actual_map;
    5.39 -  actual_map=((mainwin.mapstorage).nodemap_storage)[mapname];
    5.40 +  actual_map=((mytab.mapstorage).nodemap_storage)[mapname];
    5.41  
    5.42    double max, min;
    5.43  
    5.44 -  max=(mainwin.mapstorage).maxOfNodeMap(mapname);
    5.45 -  min=(mainwin.mapstorage).minOfNodeMap(mapname);
    5.46 +  max=(mytab.mapstorage).maxOfNodeMap(mapname);
    5.47 +  min=(mytab.mapstorage).minOfNodeMap(mapname);
    5.48  
    5.49    if(node==INVALID)
    5.50      {
    5.51  
    5.52 -      for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
    5.53 +      for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
    5.54  	{
    5.55  	  Gdk::Color color;
    5.56  
    5.57 @@ -178,7 +178,7 @@
    5.58    //the minimum of the nodemap to the range of
    5.59    //green in RGB
    5.60  
    5.61 -  Graph::NodeMap<double> actual_map((mainwin.mapstorage).graph,node_property_defaults[N_COLOR]);
    5.62 +  Graph::NodeMap<double> actual_map((mytab.mapstorage).graph,node_property_defaults[N_COLOR]);
    5.63  
    5.64    double max, min;
    5.65  
    5.66 @@ -188,7 +188,7 @@
    5.67    if(node==INVALID)
    5.68      {
    5.69  
    5.70 -      for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
    5.71 +      for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
    5.72  	{
    5.73  	  Gdk::Color color;
    5.74  
    5.75 @@ -235,11 +235,11 @@
    5.76    //that is the deleter map
    5.77  
    5.78    Graph::NodeMap<double> * actual_map=NULL;
    5.79 -  actual_map=((mainwin.mapstorage).nodemap_storage)[mapname];
    5.80 +  actual_map=((mytab.mapstorage).nodemap_storage)[mapname];
    5.81  
    5.82    if(node==INVALID)
    5.83      {
    5.84 -      for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
    5.85 +      for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
    5.86  	{
    5.87  	  nodemap_to_edit=mapname;
    5.88  	  double number=(*actual_map)[i];
    5.89 @@ -272,7 +272,7 @@
    5.90  
    5.91    if(node==INVALID)
    5.92      {
    5.93 -      for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
    5.94 +      for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
    5.95  	{
    5.96  	  nodemap_to_edit="";
    5.97  	  nodetextmap[i]->property_text().set_value("");
     6.1 --- a/graph_displayer_canvas.cc	Wed Nov 30 13:24:23 2005 +0000
     6.2 +++ b/graph_displayer_canvas.cc	Tue Dec 06 10:53:38 2005 +0000
     6.3 @@ -1,11 +1,11 @@
     6.4  #include "graph_displayer_canvas.h"
     6.5  #include <cmath>
     6.6  
     6.7 -GraphDisplayerCanvas::GraphDisplayerCanvas(MainWin & mainw) :
     6.8 +GraphDisplayerCanvas::GraphDisplayerCanvas(NoteBookTab & mainw) :
     6.9    nodesmap(mainw.mapstorage.graph), edgesmap(mainw.mapstorage.graph), edgetextmap(mainw.mapstorage.graph),
    6.10    nodetextmap(mainw.mapstorage.graph), displayed_graph(*(root()), 0, 0),
    6.11    isbutton(0), active_item(NULL), target_item(NULL), nodemap_to_edit(""),
    6.12 -  edgemap_to_edit(""), mainwin(mainw)
    6.13 +  edgemap_to_edit(""), mytab(mainw)
    6.14  {
    6.15    //base event handler is move tool
    6.16    actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::moveEventHandler), false);
    6.17 @@ -18,13 +18,13 @@
    6.18  
    6.19  GraphDisplayerCanvas::~GraphDisplayerCanvas()
    6.20  {
    6.21 -  for (NodeIt n((mainwin.mapstorage).graph); n != INVALID; ++n)
    6.22 +  for (NodeIt n((mytab.mapstorage).graph); n != INVALID; ++n)
    6.23      {
    6.24        delete nodesmap[n];
    6.25        delete nodetextmap[n];
    6.26      }
    6.27    
    6.28 -  for (EdgeIt e((mainwin.mapstorage).graph); e != INVALID; ++e)
    6.29 +  for (EdgeIt e((mytab.mapstorage).graph); e != INVALID; ++e)
    6.30      {
    6.31        delete edgesmap[e];
    6.32        delete edgetextmap[e];
    6.33 @@ -63,11 +63,11 @@
    6.34  {
    6.35    dummy=dummy;
    6.36  
    6.37 -  std::string mapname=mainwin.getActiveNodeMap(prop);
    6.38 +  std::string mapname=mytab.getActiveNodeMap(prop);
    6.39  
    6.40    if(mapname!="")
    6.41      {
    6.42 -      if( ( ((mainwin.mapstorage).nodemap_storage).find(mapname) != ((mainwin.mapstorage).nodemap_storage).end() ) )
    6.43 +      if( ( ((mytab.mapstorage).nodemap_storage).find(mapname) != ((mytab.mapstorage).nodemap_storage).end() ) )
    6.44  	{
    6.45  	  switch(prop)
    6.46  	    {
    6.47 @@ -110,11 +110,11 @@
    6.48  {
    6.49    dummy=dummy;
    6.50  
    6.51 -  std::string mapname=mainwin.getActiveEdgeMap(prop);
    6.52 +  std::string mapname=mytab.getActiveEdgeMap(prop);
    6.53  
    6.54    if(mapname!="")
    6.55      {
    6.56 -      if( ( ((mainwin.mapstorage).edgemap_storage).find(mapname) != ((mainwin.mapstorage).edgemap_storage).end() ) )
    6.57 +      if( ( ((mytab.mapstorage).edgemap_storage).find(mapname) != ((mytab.mapstorage).edgemap_storage).end() ) )
    6.58  	{
    6.59  	  switch(prop)
    6.60  	    {
    6.61 @@ -155,18 +155,18 @@
    6.62  {
    6.63    //first edges are drawn, to hide joining with nodes later
    6.64  
    6.65 -  for (EdgeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
    6.66 +  for (EdgeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
    6.67    {
    6.68  
    6.69      //drawing green lines, coordinates are from mapstorage.coords
    6.70  
    6.71      Gnome::Canvas::Points coos;
    6.72      coos.push_back(Gnome::Art::Point(
    6.73 -          (mainwin.mapstorage).coords[(mainwin.mapstorage).graph.source(i)].x,
    6.74 -          (mainwin.mapstorage).coords[(mainwin.mapstorage).graph.source(i)].y));
    6.75 +          (mytab.mapstorage).coords[(mytab.mapstorage).graph.source(i)].x,
    6.76 +          (mytab.mapstorage).coords[(mytab.mapstorage).graph.source(i)].y));
    6.77      coos.push_back(Gnome::Art::Point(
    6.78 -          (mainwin.mapstorage).coords[(mainwin.mapstorage).graph.target(i)].x,
    6.79 -          (mainwin.mapstorage).coords[(mainwin.mapstorage).graph.target(i)].y));
    6.80 +          (mytab.mapstorage).coords[(mytab.mapstorage).graph.target(i)].x,
    6.81 +          (mytab.mapstorage).coords[(mytab.mapstorage).graph.target(i)].y));
    6.82      
    6.83      edgesmap[i]=new BrokenEdge(displayed_graph, coos, *this);
    6.84      *(edgesmap[i]) << Gnome::Canvas::Properties::fill_color("green");
    6.85 @@ -186,16 +186,16 @@
    6.86  
    6.87    //afterwards nodes come to be drawn
    6.88  
    6.89 -  for (NodeIt i((mainwin.mapstorage).graph); i!=INVALID; ++i)
    6.90 +  for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i)
    6.91    {
    6.92      //drawing bule nodes, with black line around them
    6.93  
    6.94      nodesmap[i]=new Gnome::Canvas::Ellipse(
    6.95          displayed_graph,
    6.96 -        (mainwin.mapstorage).coords[i].x-20,
    6.97 -        (mainwin.mapstorage).coords[i].y-20,
    6.98 -        (mainwin.mapstorage).coords[i].x+20,
    6.99 -        (mainwin.mapstorage).coords[i].y+20);
   6.100 +        (mytab.mapstorage).coords[i].x-20,
   6.101 +        (mytab.mapstorage).coords[i].y-20,
   6.102 +        (mytab.mapstorage).coords[i].x+20,
   6.103 +        (mytab.mapstorage).coords[i].y+20);
   6.104      *(nodesmap[i]) << Gnome::Canvas::Properties::fill_color("blue");
   6.105      *(nodesmap[i]) << Gnome::Canvas::Properties::outline_color("black");
   6.106      nodesmap[i]->raise_to_top();
   6.107 @@ -203,8 +203,8 @@
   6.108      //initializing edge-text as well, to empty string
   6.109  
   6.110      xy<double> text_pos(
   6.111 -        ((mainwin.mapstorage).coords[i].x+node_property_defaults[N_RADIUS]+5),
   6.112 -        ((mainwin.mapstorage).coords[i].y+node_property_defaults[N_RADIUS]+5));
   6.113 +        ((mytab.mapstorage).coords[i].x+node_property_defaults[N_RADIUS]+5),
   6.114 +        ((mytab.mapstorage).coords[i].y+node_property_defaults[N_RADIUS]+5));
   6.115  
   6.116      nodetextmap[i]=new Gnome::Canvas::Text(displayed_graph,
   6.117          text_pos.x, text_pos.y, "");
   6.118 @@ -222,13 +222,13 @@
   6.119    active_edge=INVALID;
   6.120    forming_edge=INVALID;
   6.121  
   6.122 -  for (NodeIt n((mainwin.mapstorage).graph); n != INVALID; ++n)
   6.123 +  for (NodeIt n((mytab.mapstorage).graph); n != INVALID; ++n)
   6.124    {
   6.125      delete nodesmap[n];
   6.126      delete nodetextmap[n];
   6.127    }
   6.128  
   6.129 -  for (EdgeIt e((mainwin.mapstorage).graph); e != INVALID; ++e)
   6.130 +  for (EdgeIt e((mytab.mapstorage).graph); e != INVALID; ++e)
   6.131    {
   6.132      delete edgesmap[e];
   6.133      delete edgetextmap[e];
     7.1 --- a/graph_displayer_canvas.h	Wed Nov 30 13:24:23 2005 +0000
     7.2 +++ b/graph_displayer_canvas.h	Tue Dec 06 10:53:38 2005 +0000
     7.3 @@ -6,7 +6,7 @@
     7.4  class GraphDisplayerCanvas;
     7.5  
     7.6  #include "all_include.h"
     7.7 -#include "main_win.h"
     7.8 +#include "nbtab.h"
     7.9  #include <libgnomecanvasmm.h>
    7.10  #include <libgnomecanvasmm/polygon.h>
    7.11  #include <lemon/xy.h>
    7.12 @@ -39,7 +39,7 @@
    7.13    typedef Gnome::Canvas::CanvasAA Parent;
    7.14  
    7.15  public:
    7.16 -  GraphDisplayerCanvas(MainWin &);
    7.17 +  GraphDisplayerCanvas(NoteBookTab &);
    7.18    virtual ~GraphDisplayerCanvas();
    7.19  
    7.20    ///Changes the linewidth attribute according to the given map.
    7.21 @@ -198,7 +198,7 @@
    7.22  private:
    7.23  
    7.24    ///reference to the parent window
    7.25 -  MainWin & mainwin;
    7.26 +  NoteBookTab & mytab;
    7.27  
    7.28  };
    7.29  
     8.1 --- a/main_win.cc	Wed Nov 30 13:24:23 2005 +0000
     8.2 +++ b/main_win.cc	Tue Dec 06 10:53:38 2005 +0000
     8.3 @@ -1,19 +1,13 @@
     8.4  #include "main_win.h"
     8.5  #include "icons/guipixbufs.h"
     8.6  
     8.7 -MainWin::MainWin():mapwinexists(false)
     8.8 +MainWin::MainWin()
     8.9  {
    8.10 -  gd_canvas=new GraphDisplayerCanvas(*this);
    8.11 -
    8.12 -  set_title ("unsaved file - " + prog_name);
    8.13 +  set_title ("no file");
    8.14    set_default_size(WIN_WIDTH,WIN_HEIGHT);
    8.15    add(vbox);
    8.16  
    8.17 -  //connecting signals - controller character
    8.18 -  mapstorage.signal_prop_ch().connect(sigc::mem_fun(*gd_canvas, &GraphDisplayerCanvas::propertyChange));
    8.19 -
    8.20    // custom icons for the toolbar
    8.21 -
    8.22    Glib::RefPtr<Gtk::IconFactory> p_icon_factory = Gtk::IconFactory::create();
    8.23   
    8.24    Glib::RefPtr<Gdk::Pixbuf> p_move_pixbuf = Gdk::Pixbuf::create_from_inline(
    8.25 @@ -75,10 +69,11 @@
    8.26  
    8.27    p_icon_factory->add_default();
    8.28    
    8.29 -
    8.30    ag=Gtk::ActionGroup::create();
    8.31  
    8.32    ag->add( Gtk::Action::create("FileMenu", "_File") );
    8.33 +  ag->add( Gtk::Action::create("FileNewTab", "New _Tab"),
    8.34 +      sigc::mem_fun(*this, &MainWin::newTab));
    8.35    ag->add( Gtk::Action::create("FileNew", Gtk::Stock::NEW),
    8.36        sigc::mem_fun(*this, &MainWin::newFile));
    8.37    ag->add( Gtk::Action::create("FileOpen", Gtk::Stock::OPEN),
    8.38 @@ -94,13 +89,13 @@
    8.39  
    8.40    ag->add( Gtk::Action::create("ViewMenu", "_View") );
    8.41    ag->add( Gtk::Action::create("ViewZoomIn", Gtk::Stock::ZOOM_IN),
    8.42 -      sigc::mem_fun(*(this->gd_canvas), &GraphDisplayerCanvas::zoomIn));
    8.43 +      sigc::mem_fun(*this, &MainWin::zoomIn));
    8.44    ag->add( Gtk::Action::create("ViewZoomOut", Gtk::Stock::ZOOM_OUT),
    8.45 -      sigc::mem_fun(*(this->gd_canvas), &GraphDisplayerCanvas::zoomOut));
    8.46 +      sigc::mem_fun(*this, &MainWin::zoomOut));
    8.47    ag->add( Gtk::Action::create("ViewZoomFit", Gtk::Stock::ZOOM_FIT),
    8.48 -      sigc::mem_fun(*(this->gd_canvas), &GraphDisplayerCanvas::zoomFit));
    8.49 +      sigc::mem_fun(*this, &MainWin::zoomFit));
    8.50    ag->add( Gtk::Action::create("ViewZoom100", Gtk::Stock::ZOOM_100),
    8.51 -      sigc::mem_fun(*(this->gd_canvas), &GraphDisplayerCanvas::zoom100));
    8.52 +      sigc::mem_fun(*this, &MainWin::zoom100));
    8.53    
    8.54    ag->add( Gtk::Action::create("ShowMenu", "_Show") );
    8.55    ag->add( Gtk::Action::create("ShowMaps", "_Maps"),
    8.56 @@ -108,21 +103,21 @@
    8.57  
    8.58    Gtk::RadioAction::Group tool_group;
    8.59    ag->add( Gtk::RadioAction::create(tool_group, "MoveItem", Gtk::StockID("gd-move"), "Move"),
    8.60 -      sigc::bind( sigc::mem_fun ( *(this->gd_canvas), &GraphDisplayerCanvas::changeEditorialTool ), 0) );
    8.61 +      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 0) );
    8.62    ag->add( Gtk::RadioAction::create(tool_group, "CreateNode", Gtk::StockID("gd-addnode"), "Create node"),
    8.63 -      sigc::bind( sigc::mem_fun ( *(this->gd_canvas), &GraphDisplayerCanvas::changeEditorialTool ), 1) );
    8.64 +      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 1) );
    8.65    ag->add( Gtk::RadioAction::create(tool_group, "CreateEdge", Gtk::StockID("gd-addlink"), "Create edge"),
    8.66 -      sigc::bind( sigc::mem_fun ( *(this->gd_canvas), &GraphDisplayerCanvas::changeEditorialTool ), 2) );
    8.67 +      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 2) );
    8.68    ag->add( Gtk::RadioAction::create(tool_group, "EraseItem", Gtk::StockID("gd-delete"), "Delete"),
    8.69 -      sigc::bind( sigc::mem_fun ( *(this->gd_canvas), &GraphDisplayerCanvas::changeEditorialTool ), 3) );
    8.70 +      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 3) );
    8.71  
    8.72    ag->add( Gtk::RadioAction::create(tool_group, "EditEdgeMap", Gtk::StockID("gd-editlink"), "Edit edge map"),
    8.73 -      sigc::bind( sigc::mem_fun ( *(this->gd_canvas), &GraphDisplayerCanvas::changeEditorialTool ), 4) );
    8.74 +      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 4) );
    8.75    ag->add( Gtk::RadioAction::create(tool_group, "EditNodeMap", Gtk::StockID("gd-editnode"), "Edit node map"),
    8.76 -      sigc::bind( sigc::mem_fun ( *(this->gd_canvas), &GraphDisplayerCanvas::changeEditorialTool ), 5) );
    8.77 +      sigc::bind( sigc::mem_fun ( *this, &MainWin::changeEditorialTool ), 5) );
    8.78  
    8.79    ag->add( Gtk::Action::create("AddMap", Gtk::StockID("gd-newmap")),
    8.80 -      sigc::mem_fun (new NewMapWin("NewMapWin", *this), &NewMapWin::show ) );
    8.81 +      sigc::mem_fun ( *this , &MainWin::createNewMapWin ) );
    8.82  
    8.83    uim=Gtk::UIManager::create();
    8.84    uim->insert_action_group(ag);
    8.85 @@ -135,6 +130,7 @@
    8.86        "<ui>"
    8.87        "  <menubar name='MenuBar'>"
    8.88        "    <menu action='FileMenu'>"
    8.89 +      "      <menuitem action='FileNewTab'/>"
    8.90        "      <menuitem action='FileNew'/>"
    8.91        "      <menuitem action='FileOpen'/>"
    8.92        "      <menuitem action='FileSave'/>"
    8.93 @@ -194,208 +190,171 @@
    8.94      vbox.pack_start(*toolbar, Gtk::PACK_SHRINK);
    8.95    }
    8.96  
    8.97 -  Gtk::ScrolledWindow* pScrolledWindow = manage(new Gtk::ScrolledWindow());
    8.98 -  pScrolledWindow->set_shadow_type(Gtk::SHADOW_IN);
    8.99 -  pScrolledWindow->add(*gd_canvas);
   8.100 -  vbox.pack_start(*pScrolledWindow);
   8.101 -
   8.102    tooltips.set_tip(*(uim->get_widget("/ToolBar/CreateNode")),"Create Node");
   8.103    tooltips.enable();
   8.104  
   8.105 +  active_tab=-1;
   8.106 +  notebook.signal_switch_page().connect(sigc::mem_fun(*this, &MainWin::onChangeTab));
   8.107 +
   8.108 +  vbox.pack_start(notebook);
   8.109 +  
   8.110    show_all_children();
   8.111  }
   8.112  
   8.113 -void MainWin::readFile(const std::string &file)
   8.114 +void MainWin::set_tabtitle(std::string name)
   8.115  {
   8.116 -  mapstorage.readFromFile(file);
   8.117 -  mapstorage.file_name = file;
   8.118 -  mapstorage.modified = false;
   8.119 -  gd_canvas->drawGraph();
   8.120 -  if(mapwinexists)
   8.121 -    {
   8.122 -      mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
   8.123 -    }
   8.124 -  set_title(Glib::filename_display_basename(file) + " - " + prog_name);
   8.125 +  tabnames[active_tab]=name;
   8.126 +  set_title(tabnames[active_tab] + " - " + prog_name);
   8.127 +  notebook.set_tab_label_text((Widget&)*(tabs[active_tab]), tabnames[active_tab]);
   8.128 +}
   8.129 +
   8.130 +void MainWin::readFile(const std::string & filename)
   8.131 +{
   8.132 +  newTab();
   8.133 +  tabs[active_tab]->readFile(filename);
   8.134 +}
   8.135 +
   8.136 +void MainWin::newTab()
   8.137 +{
   8.138 +  int size=tabs.size();
   8.139 +  tabs.resize(size+1);
   8.140 +  tabnames.resize(size+1);
   8.141 +  active_tab=size;
   8.142 +  tabs[active_tab]=new NoteBookTab();
   8.143 +  tabnames[active_tab]="unsaved file";
   8.144 +  tabs[active_tab]->signal_title_ch().connect(sigc::mem_fun(*this, &MainWin::set_tabtitle));
   8.145 +  tabs[active_tab]->signal_newmap_needed().connect(sigc::mem_fun(*this, &MainWin::createNewMapWinAfterSignal));
   8.146 +  tabs[active_tab]->gd_canvas->changeEditorialTool(active_tool);
   8.147 +  notebook.append_page((Gtk::Widget&)(*(tabs[active_tab])));
   8.148 +  notebook.set_current_page(size);
   8.149 +  set_tabtitle(tabnames[active_tab]);
   8.150 +}
   8.151 +
   8.152 +void MainWin::onChangeTab(GtkNotebookPage* page, guint page_num)
   8.153 +{
   8.154 +  page=page;
   8.155 +  active_tab=page_num;
   8.156 +  tabs[active_tab]->gd_canvas->changeEditorialTool(active_tool);
   8.157 +  set_title(tabnames[active_tab]);
   8.158 +}
   8.159 +
   8.160 +void MainWin::onCloseTab()
   8.161 +{
   8.162  }
   8.163  
   8.164  void MainWin::newFile()
   8.165  {
   8.166 -  if (mapstorage.modified)
   8.167 -  {
   8.168 -    Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true,
   8.169 -        Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
   8.170 -    mdialog.add_button("Close _without Saving", Gtk::RESPONSE_REJECT);
   8.171 -    mdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
   8.172 -    mdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
   8.173 -    switch (mdialog.run())
   8.174 +  if(active_tab!=-1)
   8.175      {
   8.176 -      case Gtk::RESPONSE_CANCEL:
   8.177 -        return;
   8.178 -      case Gtk::RESPONSE_REJECT:
   8.179 -        break;
   8.180 -      case Gtk::RESPONSE_ACCEPT:
   8.181 -        saveFile();
   8.182 -        break;
   8.183 +      tabs[active_tab]->newFile();
   8.184      }
   8.185 -  }
   8.186 -  gd_canvas->clear();
   8.187 -  mapstorage.clear();
   8.188 -  if(mapwinexists)
   8.189 -    {
   8.190 -      mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
   8.191 -    }
   8.192 -  set_title("unsaved file - " + prog_name);
   8.193  }
   8.194 -
   8.195 + 
   8.196  void MainWin::openFile()
   8.197  {
   8.198 -  if (mapstorage.modified)
   8.199 -  {
   8.200 -    Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true, 
   8.201 -        Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
   8.202 -    mdialog.add_button("Close _without Saving", Gtk::RESPONSE_REJECT);
   8.203 -    mdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
   8.204 -    mdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
   8.205 -    switch (mdialog.run())
   8.206 +  if(active_tab!=-1)
   8.207      {
   8.208 -      case Gtk::RESPONSE_CANCEL:
   8.209 -        return;
   8.210 -      case Gtk::RESPONSE_REJECT:
   8.211 -        break;
   8.212 -      case Gtk::RESPONSE_ACCEPT:
   8.213 -        saveFile();
   8.214 -        break;
   8.215 +      tabs[active_tab]->openFile();
   8.216      }
   8.217 -  }
   8.218 -  Gtk::FileChooserDialog fcdialog("Open File");
   8.219 -  fcdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
   8.220 -  fcdialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_ACCEPT);
   8.221 -  if (fcdialog.run() == Gtk::RESPONSE_ACCEPT)
   8.222 -  {
   8.223 -    gd_canvas->clear();
   8.224 -    mapstorage.clear();
   8.225 -    Glib::ustring filename = fcdialog.get_filename();
   8.226 -    if (!mapstorage.readFromFile(filename))
   8.227 -    {
   8.228 -      mapstorage.file_name = filename;
   8.229 -      mapstorage.modified = false;
   8.230 -      gd_canvas->drawGraph();
   8.231 -      if(mapwinexists)
   8.232 -	{
   8.233 -	  mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
   8.234 -	}
   8.235 -      set_title(Glib::filename_display_basename(filename) + " - " + prog_name);
   8.236 -    }
   8.237 -  }
   8.238  }
   8.239 -
   8.240 + 
   8.241  void MainWin::saveFile()
   8.242  {
   8.243 -  if (mapstorage.file_name == "") {
   8.244 -    saveFileAs();
   8.245 -  }
   8.246 -  else
   8.247 -  {
   8.248 -    mapstorage.writeToFile(mapstorage.file_name);
   8.249 -    mapstorage.modified = false;
   8.250 -    set_title(Glib::filename_display_basename(mapstorage.file_name) + " - " +
   8.251 -        prog_name);
   8.252 -  }
   8.253 +  if(active_tab!=-1)
   8.254 +    {
   8.255 +      tabs[active_tab]->saveFile();
   8.256 +    }
   8.257  }
   8.258 -
   8.259 + 
   8.260  void MainWin::saveFileAs()
   8.261  {
   8.262 -  Gtk::FileChooserDialog fcdialog("Save File", Gtk::FILE_CHOOSER_ACTION_SAVE);
   8.263 -  fcdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
   8.264 -  fcdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
   8.265 -  if (fcdialog.run() == Gtk::RESPONSE_ACCEPT)
   8.266 -  {
   8.267 -    Glib::ustring filename = fcdialog.get_filename();
   8.268 -    mapstorage.file_name = filename;
   8.269 -    mapstorage.writeToFile(filename);
   8.270 -    mapstorage.modified = false;
   8.271 -    set_title(Glib::filename_display_basename(filename) + " - " + prog_name);
   8.272 -  }
   8.273 +  if(active_tab!=-1)
   8.274 +    {
   8.275 +      tabs[active_tab]->saveFileAs();
   8.276 +    }
   8.277  }
   8.278 -
   8.279 + 
   8.280  void MainWin::close()
   8.281  {
   8.282 -  if (mapstorage.modified)
   8.283 -  {
   8.284 -    Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true,
   8.285 -        Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
   8.286 -    mdialog.add_button("Close _without Saving", Gtk::RESPONSE_REJECT);
   8.287 -    mdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
   8.288 -    mdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
   8.289 -    switch (mdialog.run())
   8.290 +  if(active_tab!=-1)
   8.291      {
   8.292 -      case Gtk::RESPONSE_CANCEL:
   8.293 -        return;
   8.294 -      case Gtk::RESPONSE_REJECT:
   8.295 -        break;
   8.296 -      case Gtk::RESPONSE_ACCEPT:
   8.297 -        saveFile();
   8.298 -        break;
   8.299 -    }
   8.300 -  }
   8.301 -  gd_canvas->clear();
   8.302 -  mapstorage.clear();
   8.303 -  if(mapwinexists)
   8.304 -    {
   8.305 -      mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
   8.306 -    }
   8.307 -  set_title("unsaved file - " + prog_name);
   8.308 -}
   8.309 -
   8.310 -void MainWin::propertyChange(bool itisedge, int prop, std::string mapname)
   8.311 -{
   8.312 -  mapstorage.changeActiveMap(itisedge, prop, mapname);
   8.313 -}
   8.314 -
   8.315 -void MainWin::popupNewMapWin(bool itisedge, int prop)
   8.316 -{
   8.317 -  prop=prop;
   8.318 -  (new NewMapWin("NewMapWin", *this, itisedge, false))->run();
   8.319 -}
   8.320 -
   8.321 -std::string MainWin::getActiveEdgeMap(int prop)
   8.322 -{
   8.323 -  return mapstorage.getActiveEdgeMap(prop);
   8.324 -}
   8.325 -
   8.326 -std::string MainWin::getActiveNodeMap(int prop)
   8.327 -{
   8.328 -  return mapstorage.getActiveNodeMap(prop);
   8.329 -}
   8.330 -
   8.331 -void MainWin::registerNewEdgeMap(std::string mapname)
   8.332 -{
   8.333 -  if(mapwinexists)
   8.334 -    {
   8.335 -      mapwin->registerNewEdgeMap(mapname);
   8.336 +      tabs[active_tab]->close();
   8.337      }
   8.338  }
   8.339  
   8.340 -void MainWin::registerNewNodeMap(std::string mapname)
   8.341 +void MainWin::zoomIn()
   8.342  {
   8.343 -  if(mapwinexists)
   8.344 +  if(active_tab!=-1)
   8.345      {
   8.346 -      mapwin->registerNewNodeMap(mapname);
   8.347 +      tabs[active_tab]->gd_canvas->zoomIn();
   8.348 +    }
   8.349 +}
   8.350 +
   8.351 +void MainWin::zoomOut()
   8.352 +{
   8.353 +  if(active_tab!=-1)
   8.354 +    {
   8.355 +      tabs[active_tab]->gd_canvas->zoomOut();
   8.356 +    }
   8.357 +}
   8.358 +
   8.359 +void MainWin::zoomFit()
   8.360 +{
   8.361 +  if(active_tab!=-1)
   8.362 +    {
   8.363 +      tabs[active_tab]->gd_canvas->zoomFit();
   8.364 +    }
   8.365 +}
   8.366 +
   8.367 +void MainWin::zoom100()
   8.368 +{
   8.369 +  if(active_tab!=-1)
   8.370 +    {
   8.371 +      tabs[active_tab]->gd_canvas->zoom100();
   8.372      }
   8.373  }
   8.374  
   8.375  void MainWin::createMapWin()
   8.376  {
   8.377 -  if(!mapwinexists)
   8.378 +  if(active_tab!=-1)
   8.379      {
   8.380 -      mapwin=new MapWin("Map Setup", mapstorage.getEdgeMapList(), mapstorage.getNodeMapList(), *this);
   8.381 -      mapwin->show();
   8.382 -      mapwinexists=true;
   8.383 +      tabs[active_tab]->createMapWin(tabnames[active_tab]);
   8.384      }
   8.385  }
   8.386  
   8.387 -void MainWin::closeMapWin()
   8.388 +void MainWin::changeEditorialTool(int tool)
   8.389  {
   8.390 -  mapwinexists=false;
   8.391 -  delete mapwin;
   8.392 +  active_tool=tool;
   8.393 +  if(active_tab!=-1)
   8.394 +    {
   8.395 +      tabs[active_tab]->gd_canvas->changeEditorialTool(tool);
   8.396 +    }
   8.397  }
   8.398 +
   8.399 +void MainWin::createNewMapWin()
   8.400 +{
   8.401 +  if(active_tab!=-1)
   8.402 +    {
   8.403 +      NewMapWin * nmw=new NewMapWin("Create New Map - "+tabnames[active_tab], *(tabs[active_tab]));
   8.404 +      nmw->show();
   8.405 +    }
   8.406 +}
   8.407 +
   8.408 +void MainWin::createNewMapWinAfterSignal(NoteBookTab * nbt, bool itisedge)
   8.409 +{
   8.410 +  std::vector<NoteBookTab*>::iterator nbti=tabs.begin();
   8.411 +  int i=0;
   8.412 +  for(;nbti!=tabs.end();nbti++)
   8.413 +    {
   8.414 +      if(*nbti!=nbt)
   8.415 +	{
   8.416 +	  i++;
   8.417 +	}
   8.418 +      else
   8.419 +	{
   8.420 +	  continue;
   8.421 +	}
   8.422 +    }
   8.423 +  NewMapWin * nmw=new NewMapWin("Create New Map - "+tabnames[i], *nbt, itisedge, false);
   8.424 +  nmw->run();
   8.425 +}
     9.1 --- a/main_win.h	Wed Nov 30 13:24:23 2005 +0000
     9.2 +++ b/main_win.h	Tue Dec 06 10:53:38 2005 +0000
     9.3 @@ -3,35 +3,36 @@
     9.4  #ifndef MAIN_WIN_H
     9.5  #define MAIN_WIN_H
     9.6  
     9.7 -class MainWin;
     9.8 -
     9.9  #include "all_include.h"
    9.10 -#include "mapstorage.h"
    9.11  #include "map_win.h"
    9.12  #include "new_map_win.h"
    9.13 -#include "graph_displayer_canvas.h"
    9.14 +#include "nbtab.h"
    9.15  #include <libgnomecanvasmm.h>
    9.16  #include <libgnomecanvasmm/polygon.h>
    9.17  
    9.18 +
    9.19  ///This class is the main window of GUI.
    9.20  ///It has menus, but the main part of it is the canvas.
    9.21  class MainWin : public Gtk::Window
    9.22  {
    9.23 +  ///Container
    9.24 +  Gtk::VBox vbox;
    9.25 +
    9.26 +  Gtk::Notebook notebook;
    9.27 +
    9.28 +  int active_tool;
    9.29 +
    9.30 +  int active_tab;
    9.31 +  std::vector<NoteBookTab *> tabs;
    9.32 +  std::vector<std::string> tabnames;
    9.33 +
    9.34  public:
    9.35 -  ///Constructor of the \ref MainWin. It creates the menu and the \ref GraphDisplayerCanvas on which the graph will be drawn.
    9.36 +  
    9.37 +  ///Constructor of the \ref NoteBookTab. It creates the menu and the \ref GraphDisplayerCanvas on which the graph will be drawn.
    9.38    ///\param title is the title of the window
    9.39    MainWin();
    9.40  
    9.41 -  MapStorage mapstorage;
    9.42 -
    9.43 -  void readFile(const std::string &);
    9.44 -
    9.45 -protected:
    9.46 -  MapWin * mapwin;
    9.47 -  bool mapwinexists;
    9.48 -
    9.49 -  ///The graph will be drawn on this \ref GraphDisplayerCanvas
    9.50 -  GraphDisplayerCanvas * gd_canvas;
    9.51 +  void set_tabtitle(std::string);
    9.52  
    9.53    ///ActionGroup for menu
    9.54    Glib::RefPtr<Gtk::ActionGroup> ag;
    9.55 @@ -39,12 +40,13 @@
    9.56    ///UIManager for menu
    9.57    Glib::RefPtr<Gtk::UIManager> uim;
    9.58  
    9.59 -  ///Container
    9.60 -  Gtk::VBox vbox;
    9.61 +  void readFile(const std::string &);
    9.62  
    9.63    ///Tooltips
    9.64    Gtk::Tooltips tooltips;
    9.65  
    9.66 +  //Call-backs of buttons
    9.67 +
    9.68    ///Callback for 'FileNew' action.
    9.69    virtual void newFile();
    9.70    ///Callback for 'FileOpen' action.
    9.71 @@ -56,18 +58,26 @@
    9.72    ///Callback for 'Close' action.
    9.73    virtual void close();
    9.74  
    9.75 -public:
    9.76 -  void propertyChange(bool, int, std::string);
    9.77 -  void popupNewMapWin(bool, int);
    9.78 +  //Toolbar
    9.79 +  virtual void zoomIn();
    9.80 +  virtual void zoomOut();
    9.81 +  virtual void zoomFit();
    9.82 +  virtual void zoom100();
    9.83  
    9.84 -  std::string getActiveEdgeMap(int);
    9.85 -  std::string getActiveNodeMap(int);
    9.86 +  virtual void createMapWin();
    9.87  
    9.88 -  void registerNewEdgeMap(std::string);
    9.89 -  void registerNewNodeMap(std::string);
    9.90 +  virtual void changeEditorialTool(int);
    9.91  
    9.92 -  void createMapWin();
    9.93 -  void closeMapWin();
    9.94 +  virtual void createNewMapWinAfterSignal(NoteBookTab *, bool);
    9.95 +  virtual void createNewMapWin();
    9.96 +
    9.97 +  //Notebook handlers
    9.98 +  ///Callback for 'FileNewTab' action.
    9.99 +  virtual void newTab();
   9.100 +  virtual void onChangeTab(GtkNotebookPage*, guint);
   9.101 +  virtual void onCloseTab();
   9.102 +
   9.103 +
   9.104  };
   9.105  
   9.106  #endif //MAIN_WIN_H
    10.1 --- a/map_win.cc	Wed Nov 30 13:24:23 2005 +0000
    10.2 +++ b/map_win.cc	Tue Dec 06 10:53:38 2005 +0000
    10.3 @@ -5,13 +5,13 @@
    10.4  {
    10.5    if(e->keyval==GDK_Escape)
    10.6    {
    10.7 -    mainwin.closeMapWin();
    10.8 +    mytab.closeMapWin();
    10.9      //    hide();
   10.10    }
   10.11    return true;
   10.12  }
   10.13  
   10.14 -MapWin::MapWin(const std::string& title, std::vector<std::string> eml, std::vector<std::string> nml, MainWin & mw):mainwin(mw)
   10.15 +MapWin::MapWin(const std::string& title, std::vector<std::string> eml, std::vector<std::string> nml, NoteBookTab & mw):mytab(mw)
   10.16  {
   10.17    set_title(title);
   10.18    set_default_size(200, 50);
   10.19 @@ -24,7 +24,7 @@
   10.20  
   10.21    for(int i=0;i<EDGE_PROPERTY_NUM;i++)
   10.22    {
   10.23 -    e_combo_array[i]=new MapSelector(eml, mainwin.getActiveEdgeMap(i), i, true);
   10.24 +    e_combo_array[i]=new MapSelector(eml, mytab.getActiveEdgeMap(i), i, true);
   10.25  
   10.26      (*table).attach((*(e_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
   10.27  
   10.28 @@ -44,7 +44,7 @@
   10.29  
   10.30    for(int i=0;i<NODE_PROPERTY_NUM;i++)
   10.31    {
   10.32 -    n_combo_array[i]=new MapSelector(nml, mainwin.getActiveNodeMap(i), i, false);
   10.33 +    n_combo_array[i]=new MapSelector(nml, mytab.getActiveNodeMap(i), i, false);
   10.34  
   10.35      (*table).attach((*(n_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
   10.36  
   10.37 @@ -68,17 +68,17 @@
   10.38  
   10.39  void MapWin::nodeMapChanged(std::string mapname, int prop)
   10.40  {
   10.41 -  mainwin.propertyChange(false, prop, mapname);
   10.42 +  mytab.propertyChange(false, prop, mapname);
   10.43  }
   10.44  
   10.45  void MapWin::edgeMapChanged(std::string mapname, int prop)
   10.46  {
   10.47 -  mainwin.propertyChange(true, prop, mapname);
   10.48 +  mytab.propertyChange(true, prop, mapname);
   10.49  }
   10.50  
   10.51  void MapWin::newMapWinNeeded(bool itisedge, int prop)
   10.52  {
   10.53 -  mainwin.popupNewMapWin(itisedge, prop);
   10.54 +  mytab.popupNewMapWin(itisedge, prop);
   10.55  }
   10.56  
   10.57  void MapWin::update(std::vector<std::string> eml, std::vector<std::string> nml)
   10.58 @@ -115,6 +115,6 @@
   10.59  bool MapWin::on_delete_event(GdkEventAny * event)
   10.60  {
   10.61    event=event;
   10.62 -  mainwin.closeMapWin();
   10.63 +  mytab.closeMapWin();
   10.64    return true;
   10.65  }
    11.1 --- a/map_win.h	Wed Nov 30 13:24:23 2005 +0000
    11.2 +++ b/map_win.h	Tue Dec 06 10:53:38 2005 +0000
    11.3 @@ -6,7 +6,7 @@
    11.4  class MapWin;
    11.5  
    11.6  #include <all_include.h>
    11.7 -#include <main_win.h>
    11.8 +#include <nbtab.h>
    11.9  #include <libgnomecanvasmm.h>
   11.10  #include <libgnomecanvasmm/polygon.h>
   11.11  
   11.12 @@ -65,7 +65,7 @@
   11.13  
   11.14  
   11.15  protected:
   11.16 -  MainWin & mainwin;
   11.17 +  NoteBookTab & mytab;
   11.18  
   11.19    Gtk::Table * table;
   11.20    
   11.21 @@ -77,7 +77,7 @@
   11.22  
   11.23  public:
   11.24    ///Constructor of MapWin creates the widgets shown in MapWin.
   11.25 -  MapWin(const std::string& title, std::vector<std::string>, std::vector<std::string>, MainWin & mw);
   11.26 +  MapWin(const std::string& title, std::vector<std::string>, std::vector<std::string>, NoteBookTab & mw);
   11.27  
   11.28    ~MapWin();
   11.29  
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/nbtab.cc	Tue Dec 06 10:53:38 2005 +0000
    12.3 @@ -0,0 +1,217 @@
    12.4 +#include <nbtab.h>
    12.5 +
    12.6 +NoteBookTab::NoteBookTab():mapwinexists(false)
    12.7 +{
    12.8 +  gd_canvas=new GraphDisplayerCanvas(*this);
    12.9 +  add(*gd_canvas);
   12.10 +
   12.11 +  //connecting signals - controller character
   12.12 +  mapstorage.signal_prop_ch().connect(sigc::mem_fun(*gd_canvas, &GraphDisplayerCanvas::propertyChange));
   12.13 +  show_all_children();
   12.14 +  show();
   12.15 +}
   12.16 +
   12.17 +void NoteBookTab::readFile(const std::string &file)
   12.18 +{
   12.19 +  mapstorage.readFromFile(file);
   12.20 +  mapstorage.file_name = file;
   12.21 +  mapstorage.modified = false;
   12.22 +  gd_canvas->drawGraph();
   12.23 +  if(mapwinexists)
   12.24 +    {
   12.25 +      mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
   12.26 +    }
   12.27 +  signal_title.emit(Glib::filename_display_basename(file));
   12.28 +}
   12.29 +
   12.30 +void NoteBookTab::newFile()
   12.31 +{
   12.32 +  if (mapstorage.modified)
   12.33 +  {
   12.34 +    Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true,
   12.35 +        Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
   12.36 +    mdialog.add_button("Close _without Saving", Gtk::RESPONSE_REJECT);
   12.37 +    mdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
   12.38 +    mdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
   12.39 +    switch (mdialog.run())
   12.40 +    {
   12.41 +      case Gtk::RESPONSE_CANCEL:
   12.42 +        return;
   12.43 +      case Gtk::RESPONSE_REJECT:
   12.44 +        break;
   12.45 +      case Gtk::RESPONSE_ACCEPT:
   12.46 +        saveFile();
   12.47 +        break;
   12.48 +    }
   12.49 +  }
   12.50 +  gd_canvas->clear();
   12.51 +  mapstorage.clear();
   12.52 +  if(mapwinexists)
   12.53 +    {
   12.54 +      mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
   12.55 +    }
   12.56 +  signal_title.emit("unsaved file");
   12.57 +}
   12.58 +
   12.59 +void NoteBookTab::openFile()
   12.60 +{
   12.61 +  if (mapstorage.modified)
   12.62 +  {
   12.63 +    Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true, 
   12.64 +        Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
   12.65 +    mdialog.add_button("Close _without Saving", Gtk::RESPONSE_REJECT);
   12.66 +    mdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
   12.67 +    mdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
   12.68 +    switch (mdialog.run())
   12.69 +    {
   12.70 +      case Gtk::RESPONSE_CANCEL:
   12.71 +        return;
   12.72 +      case Gtk::RESPONSE_REJECT:
   12.73 +        break;
   12.74 +      case Gtk::RESPONSE_ACCEPT:
   12.75 +        saveFile();
   12.76 +        break;
   12.77 +    }
   12.78 +  }
   12.79 +  Gtk::FileChooserDialog fcdialog("Open File");
   12.80 +  fcdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
   12.81 +  fcdialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_ACCEPT);
   12.82 +  if (fcdialog.run() == Gtk::RESPONSE_ACCEPT)
   12.83 +  {
   12.84 +    gd_canvas->clear();
   12.85 +    mapstorage.clear();
   12.86 +    Glib::ustring filename = fcdialog.get_filename();
   12.87 +    if (!mapstorage.readFromFile(filename))
   12.88 +    {
   12.89 +      mapstorage.file_name = filename;
   12.90 +      mapstorage.modified = false;
   12.91 +      gd_canvas->drawGraph();
   12.92 +      if(mapwinexists)
   12.93 +	{
   12.94 +	  mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
   12.95 +	}
   12.96 +      signal_title.emit(Glib::filename_display_basename(filename));
   12.97 +    }
   12.98 +  }
   12.99 +}
  12.100 +
  12.101 +void NoteBookTab::saveFile()
  12.102 +{
  12.103 +  if (mapstorage.file_name == "") {
  12.104 +    saveFileAs();
  12.105 +  }
  12.106 +  else
  12.107 +  {
  12.108 +    mapstorage.writeToFile(mapstorage.file_name);
  12.109 +    mapstorage.modified = false;
  12.110 +    signal_title.emit(Glib::filename_display_basename(mapstorage.file_name));
  12.111 +  }
  12.112 +}
  12.113 +
  12.114 +void NoteBookTab::saveFileAs()
  12.115 +{
  12.116 +  Gtk::FileChooserDialog fcdialog("Save File", Gtk::FILE_CHOOSER_ACTION_SAVE);
  12.117 +  fcdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
  12.118 +  fcdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
  12.119 +  if (fcdialog.run() == Gtk::RESPONSE_ACCEPT)
  12.120 +  {
  12.121 +    Glib::ustring filename = fcdialog.get_filename();
  12.122 +    mapstorage.file_name = filename;
  12.123 +    mapstorage.writeToFile(filename);
  12.124 +    mapstorage.modified = false;
  12.125 +    signal_title.emit(Glib::filename_display_basename(filename));
  12.126 +  }
  12.127 +}
  12.128 +
  12.129 +void NoteBookTab::close()
  12.130 +{
  12.131 +  if (mapstorage.modified)
  12.132 +  {
  12.133 +    Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true,
  12.134 +        Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE);
  12.135 +    mdialog.add_button("Close _without Saving", Gtk::RESPONSE_REJECT);
  12.136 +    mdialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
  12.137 +    mdialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
  12.138 +    switch (mdialog.run())
  12.139 +    {
  12.140 +      case Gtk::RESPONSE_CANCEL:
  12.141 +        return;
  12.142 +      case Gtk::RESPONSE_REJECT:
  12.143 +        break;
  12.144 +      case Gtk::RESPONSE_ACCEPT:
  12.145 +        saveFile();
  12.146 +        break;
  12.147 +    }
  12.148 +  }
  12.149 +  gd_canvas->clear();
  12.150 +  mapstorage.clear();
  12.151 +  if(mapwinexists)
  12.152 +    {
  12.153 +      mapwin->update(mapstorage.getEdgeMapList(), mapstorage.getNodeMapList());
  12.154 +    }
  12.155 +  signal_title.emit("unsaved file");
  12.156 +}
  12.157 +
  12.158 +void NoteBookTab::propertyChange(bool itisedge, int prop, std::string mapname)
  12.159 +{
  12.160 +  mapstorage.changeActiveMap(itisedge, prop, mapname);
  12.161 +}
  12.162 +
  12.163 +sigc::signal<void, NoteBookTab *, bool> NoteBookTab::signal_newmap_needed()
  12.164 +{
  12.165 +  return signal_newmap;
  12.166 +}
  12.167 +
  12.168 +void NoteBookTab::popupNewMapWin(bool itisedge, int prop)
  12.169 +{
  12.170 +  prop=prop;
  12.171 +  signal_newmap.emit(this, itisedge);
  12.172 +}
  12.173 +
  12.174 +std::string NoteBookTab::getActiveEdgeMap(int prop)
  12.175 +{
  12.176 +  return mapstorage.getActiveEdgeMap(prop);
  12.177 +}
  12.178 +
  12.179 +std::string NoteBookTab::getActiveNodeMap(int prop)
  12.180 +{
  12.181 +  return mapstorage.getActiveNodeMap(prop);
  12.182 +}
  12.183 +
  12.184 +void NoteBookTab::registerNewEdgeMap(std::string mapname)
  12.185 +{
  12.186 +  if(mapwinexists)
  12.187 +    {
  12.188 +      mapwin->registerNewEdgeMap(mapname);
  12.189 +    }
  12.190 +}
  12.191 +
  12.192 +void NoteBookTab::registerNewNodeMap(std::string mapname)
  12.193 +{
  12.194 +  if(mapwinexists)
  12.195 +    {
  12.196 +      mapwin->registerNewNodeMap(mapname);
  12.197 +    }
  12.198 +}
  12.199 +
  12.200 +void NoteBookTab::createMapWin(std::string name)
  12.201 +{
  12.202 +  if(!mapwinexists)
  12.203 +    {
  12.204 +      mapwin=new MapWin("Map Setup - "+name, mapstorage.getEdgeMapList(), mapstorage.getNodeMapList(), *this);
  12.205 +      mapwin->show();
  12.206 +      mapwinexists=true;
  12.207 +    }
  12.208 +}
  12.209 +
  12.210 +void NoteBookTab::closeMapWin()
  12.211 +{
  12.212 +  mapwinexists=false;
  12.213 +  delete mapwin;
  12.214 +}
  12.215 +
  12.216 +sigc::signal<void, std::string> NoteBookTab::signal_title_ch()
  12.217 +{
  12.218 +  return signal_title;
  12.219 +}
  12.220 +
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/nbtab.h	Tue Dec 06 10:53:38 2005 +0000
    13.3 @@ -0,0 +1,63 @@
    13.4 +// -*- C++ -*- //
    13.5 +
    13.6 +#ifndef NBTAB_H
    13.7 +#define NBTAB_H
    13.8 +
    13.9 +class NoteBookTab;
   13.10 +
   13.11 +#include "mapstorage.h"
   13.12 +#include "map_win.h"
   13.13 +#include "graph_displayer_canvas.h"
   13.14 +#include <libgnomecanvasmm.h>
   13.15 +#include <libgnomecanvasmm/polygon.h>
   13.16 +
   13.17 +class NoteBookTab : public Gtk::VBox
   13.18 +{
   13.19 +public:
   13.20 +  NoteBookTab();
   13.21 +  
   13.22 +  MapStorage mapstorage;
   13.23 +    
   13.24 +  sigc::signal<void, std::string> signal_title;
   13.25 +
   13.26 +  sigc::signal<void, std::string> signal_title_ch();
   13.27 +
   13.28 +  sigc::signal<void, NoteBookTab *, bool> signal_newmap;
   13.29 +
   13.30 +  sigc::signal<void, NoteBookTab *, bool> signal_newmap_needed();
   13.31 +
   13.32 +  void readFile(const std::string &);
   13.33 +    
   13.34 +  ///The graph will be drawn on this \ref GraphDisplayerCanvas
   13.35 +  GraphDisplayerCanvas * gd_canvas;
   13.36 +
   13.37 +  bool mapwinexists;
   13.38 +
   13.39 +  MapWin * mapwin;
   13.40 +    
   13.41 +public:
   13.42 +  ///Callback for 'FileNew' action.
   13.43 +  virtual void newFile();
   13.44 +  ///Callback for 'FileOpen' action.
   13.45 +  virtual void openFile();
   13.46 +  ///Callback for 'FileSave' action.
   13.47 +  virtual void saveFile();
   13.48 +  ///Callback for 'FileSaveAs' action.
   13.49 +  virtual void saveFileAs();
   13.50 +  ///Callback for 'Close' action.
   13.51 +  virtual void close();
   13.52 +
   13.53 +  void propertyChange(bool, int, std::string);
   13.54 +  void popupNewMapWin(bool, int);
   13.55 +
   13.56 +  std::string getActiveEdgeMap(int);
   13.57 +  std::string getActiveNodeMap(int);
   13.58 +
   13.59 +  void registerNewEdgeMap(std::string);
   13.60 +  void registerNewNodeMap(std::string);
   13.61 +
   13.62 +  void createMapWin(std::string);
   13.63 +  void closeMapWin();
   13.64 +};
   13.65 +
   13.66 +#endif //NBTAB_H
    14.1 --- a/new_map_win.cc	Wed Nov 30 13:24:23 2005 +0000
    14.2 +++ b/new_map_win.cc	Tue Dec 06 10:53:38 2005 +0000
    14.3 @@ -9,7 +9,7 @@
    14.4    return true;
    14.5  }
    14.6  
    14.7 -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")
    14.8 +NewMapWin::NewMapWin(const std::string& title, NoteBookTab & mw, bool itisedge, bool edgenode):Gtk::Dialog(title, true, true),mytab(mw),node("Create NodeMap"),edge("Create EdgeMap")
    14.9  {
   14.10    set_default_size(200, 50);
   14.11  
   14.12 @@ -83,11 +83,11 @@
   14.13  	  if(edge.get_active())
   14.14  	    {
   14.15  	      //create the new map
   14.16 -	      Graph::EdgeMap<double> * emptr=new Graph::EdgeMap<double> (mainwin.mapstorage.graph);
   14.17 +	      Graph::EdgeMap<double> * emptr=new Graph::EdgeMap<double> (mytab.mapstorage.graph);
   14.18  
   14.19  	      std::stack<double> polishstack;
   14.20    
   14.21 -	      for(EdgeIt k(mainwin.mapstorage.graph); k!=INVALID; ++k)
   14.22 +	      for(EdgeIt k(mytab.mapstorage.graph); k!=INVALID; ++k)
   14.23  		{
   14.24  		  for(int i=0;i<(int)polishform.size();i++)
   14.25  		    {
   14.26 @@ -106,11 +106,11 @@
   14.27  			  break;
   14.28  			default:
   14.29  			  //substitute variable
   14.30 -			  std::map< std::string,Graph::EdgeMap<double> * > ems=mainwin.mapstorage.edgemap_storage;
   14.31 +			  std::map< std::string,Graph::EdgeMap<double> * > ems=mytab.mapstorage.edgemap_storage;
   14.32  			  bool itisvar=(ems.find(ch2var[ polishform[i] ])!=ems.end());
   14.33  			  if(itisvar)
   14.34  			    {
   14.35 -			      polishstack.push( (*(mainwin.mapstorage.edgemap_storage[ ch2var[ polishform[i] ] ]))[k]);
   14.36 +			      polishstack.push( (*(mytab.mapstorage.edgemap_storage[ ch2var[ polishform[i] ] ]))[k]);
   14.37  			    }
   14.38  			  else
   14.39  			    {
   14.40 @@ -153,13 +153,13 @@
   14.41  
   14.42  	      //if addition was not successful addEdgeMap returns one.
   14.43  	      //cause can be that there is already a map named like the new one
   14.44 -	      if(mainwin.mapstorage.addEdgeMap(mapname, emptr, def_val))
   14.45 +	      if(mytab.mapstorage.addEdgeMap(mapname, emptr, def_val))
   14.46  		{
   14.47  		  abortion=1;
   14.48  		}
   14.49  
   14.50  	      //add it to the list of the displayable maps
   14.51 -	      mainwin.registerNewEdgeMap(mapname);
   14.52 +	      mytab.registerNewEdgeMap(mapname);
   14.53  
   14.54  	      //display it
   14.55  	      //gdc.changeEdgeText(mapname);
   14.56 @@ -167,11 +167,11 @@
   14.57  	  else //!edge.get_active()
   14.58  	    {
   14.59  	      //create the new map
   14.60 -	      Graph::NodeMap<double> * emptr=new Graph::NodeMap<double> (mainwin.mapstorage.graph);
   14.61 +	      Graph::NodeMap<double> * emptr=new Graph::NodeMap<double> (mytab.mapstorage.graph);
   14.62  
   14.63  	      std::stack<double> polishstack;
   14.64    
   14.65 -	      for(NodeIt k(mainwin.mapstorage.graph); k!=INVALID; ++k)
   14.66 +	      for(NodeIt k(mytab.mapstorage.graph); k!=INVALID; ++k)
   14.67  		{
   14.68  		  for(int i=0;i<(int)polishform.size();i++)
   14.69  		    {
   14.70 @@ -189,11 +189,11 @@
   14.71  			  polishstack.pop();
   14.72  			  break;
   14.73  			default:
   14.74 -			  std::map< std::string,Graph::NodeMap<double> * > nms=mainwin.mapstorage.nodemap_storage;
   14.75 +			  std::map< std::string,Graph::NodeMap<double> * > nms=mytab.mapstorage.nodemap_storage;
   14.76  			  bool itisvar=(nms.find(ch2var[ polishform[i] ])!=nms.end());
   14.77  			  if(itisvar)
   14.78  			    {
   14.79 -			      polishstack.push( (*(mainwin.mapstorage.nodemap_storage[ ch2var[ polishform[i] ] ]))[k]);
   14.80 +			      polishstack.push( (*(mytab.mapstorage.nodemap_storage[ ch2var[ polishform[i] ] ]))[k]);
   14.81  			    }
   14.82  			  else
   14.83  			    {
   14.84 @@ -236,13 +236,13 @@
   14.85  
   14.86  	      //if addition was not successful addNodeMap returns one.
   14.87  	      //cause can be that there is already a map named like the new one
   14.88 -	      if(mainwin.mapstorage.addNodeMap(mapname,emptr, def_val))
   14.89 +	      if(mytab.mapstorage.addNodeMap(mapname,emptr, def_val))
   14.90  		{
   14.91  		  abortion=1;
   14.92  		}
   14.93  
   14.94  	      //add it to the list of the displayable maps
   14.95 -	      mainwin.registerNewNodeMap(mapname);
   14.96 +	      mytab.registerNewNodeMap(mapname);
   14.97  
   14.98  	      //display it
   14.99  	      //gdc.changeNodeText(mapname);
  14.100 @@ -431,11 +431,11 @@
  14.101    //is it mapname?
  14.102    if(itisedge)
  14.103      {
  14.104 -      cancel=(mainwin.mapstorage.edgemap_storage.find(variable)==mainwin.mapstorage.edgemap_storage.end());
  14.105 +      cancel=(mytab.mapstorage.edgemap_storage.find(variable)==mytab.mapstorage.edgemap_storage.end());
  14.106      }
  14.107    else
  14.108      {
  14.109 -      cancel=(mainwin.mapstorage.nodemap_storage.find(variable)==mainwin.mapstorage.nodemap_storage.end());
  14.110 +      cancel=(mytab.mapstorage.nodemap_storage.find(variable)==mytab.mapstorage.nodemap_storage.end());
  14.111      }
  14.112    //maybe it is number
  14.113    int point_num=0;
    15.1 --- a/new_map_win.h	Wed Nov 30 13:24:23 2005 +0000
    15.2 +++ b/new_map_win.h	Tue Dec 06 10:53:38 2005 +0000
    15.3 @@ -6,7 +6,7 @@
    15.4  class NewMapWin;
    15.5  
    15.6  #include <all_include.h>
    15.7 -#include <main_win.h>
    15.8 +#include <nbtab.h>
    15.9  #include <libgnomecanvasmm.h>
   15.10  #include <libgnomecanvasmm/polygon.h>
   15.11  #include <stack>
   15.12 @@ -16,7 +16,7 @@
   15.13  
   15.14  class NewMapWin : public Gtk::Dialog
   15.15  {
   15.16 -  MainWin & mainwin;
   15.17 +  NoteBookTab & mytab;
   15.18  
   15.19  public:
   15.20    struct tree_node
   15.21 @@ -27,7 +27,7 @@
   15.22    };
   15.23    
   15.24    ///Constructor of NewMapWin creates the widgets shown in NewMapWin.
   15.25 -  NewMapWin(const std::string& title, MainWin &, bool itisedge=true, bool edgenode=true);
   15.26 +  NewMapWin(const std::string& title, NoteBookTab &, bool itisedge=true, bool edgenode=true);
   15.27    
   15.28    ///Signal on button is connected to this function,
   15.29    ///Therefore this function determines whether to