gui/graph_displayer_canvas.cc
changeset 1492 0d58f0301923
parent 1485 3a1c6678fa23
child 1496 c60369a1c987
equal deleted inserted replaced
8:8334bcb76227 9:d7d178781b62
   620     case GDK_BUTTON_RELEASE:
   620     case GDK_BUTTON_RELEASE:
   621       if(active_item==(get_item_at(e->button.x, e->button.y)))
   621       if(active_item==(get_item_at(e->button.x, e->button.y)))
   622 	{
   622 	{
   623 	  if(active_node!=INVALID)
   623 	  if(active_node!=INVALID)
   624 	    {
   624 	    {
   625 	      EdgeIt e;
   625 //	      EdgeIt e;
   626 	      g.firstOut(e,active_node);
   626 // 	      g.firstOut(e,active_node);
   627 	      for(;e!=INVALID;g.nextOut(e))
   627 // 	      for(;e!=INVALID;g.nextOut(e))
   628 		{
   628 // 		{
   629 		  delete_item(edgesmap[e]);
   629 // 		  if(e!=INVALID)delete_item(e);
   630 		  //edgesmap[e]->property_points().set_value(coos);
   630 // 		}
   631 		  //edgetextmap[e]->property_y().set_value((y1+y2)/2);
   631 
   632 		}
   632 // 	      g.firstIn(e,active_node);
   633 
   633 // 	      for(;e!=INVALID;g.nextIn(e))
   634 	      g.firstIn(e,active_node);
   634 // 		{
   635 	      for(;e!=INVALID;g.nextIn(e))
   635 // 		  if(e!=INVALID)delete_item(e);
   636 		{
   636 // 		}
   637 		  delete_item(edgesmap[e]);
   637 	      for (EdgeIt i(g); i!=INVALID; ++i)
   638 		  //edgesmap[e]->get_bounds(x1, y1, x2, y2);
   638 		{
   639 		  //edgetextmap[e]->property_y().set_value((y1+y2)/2);
   639 		  //std::cout << g.source(i).id << "-" << g.target(i).id << " " << active_node.id << std::endl;
   640 		}
   640 		  if((g.source(i)==active_node)||(g.target(i)==active_node))
   641 	    }
   641 		    {
   642 	  delete_item(active_item);
   642 		      delete_item(i);
       
   643 		    }
       
   644 		}
       
   645 	      delete_item(active_node);
       
   646 	    }
       
   647 	  else
       
   648 	    {
       
   649 	      delete_item(active_edge);
       
   650 	    }
       
   651 
   643 	  
   652 	  
   644 	}
   653 	}
   645       else
   654       else
   646 	{
   655 	{
   647 	  if(active_node!=INVALID)
   656 	  if(active_node!=INVALID)
   665       break;
   674       break;
   666     }
   675     }
   667   return true;
   676   return true;
   668 }
   677 }
   669 
   678 
   670 void GraphDisplayerCanvas::delete_item(Gnome::Canvas::Item * item_to_delete)
   679 void GraphDisplayerCanvas::delete_item(NodeIt node_to_delete)
   671 {
   680 {
   672   //item_to_delete->hide();
   681   delete(nodesmap[node_to_delete]);
   673   delete(item_to_delete);
   682   g.erase(node_to_delete);
   674 }
   683 }
   675 
   684 
       
   685 void GraphDisplayerCanvas::delete_item(EdgeIt edge_to_delete)
       
   686 {
       
   687   delete(edgesmap[edge_to_delete]);
       
   688   g.erase(edge_to_delete);
       
   689 }
       
   690