cout->cerr, node radius and edge width is now scaled, maps are editable by clicking on texts. gui
authorhegyi
Thu, 28 Jul 2005 15:54:00 +0000
branchgui
changeset 48b8ec84524fa2
parent 47 9a0e6e92d06c
child 49 e112465192dc
cout->cerr, node radius and edge width is now scaled, maps are editable by clicking on texts.
Makefile.am
all_include.h
graph_displayer_canvas-edge.cc
graph_displayer_canvas-event.cc
graph_displayer_canvas-node.cc
graph_displayer_canvas.cc
map_win.cc
     1.1 --- a/Makefile.am	Thu Jul 28 14:31:32 2005 +0000
     1.2 +++ b/Makefile.am	Thu Jul 28 15:54:00 2005 +0000
     1.3 @@ -18,8 +18,6 @@
     1.4  	mapstorage.h \
     1.5  	map_win.cc \
     1.6  	map_win.h \
     1.7 -	edit_win.cc \
     1.8 -	edit_win.h \
     1.9  	broken_edge.cc \
    1.10  	broken_edge.h \
    1.11  	new_map_win.cc \
     2.1 --- a/all_include.h	Thu Jul 28 14:31:32 2005 +0000
     2.2 +++ b/all_include.h	Thu Jul 28 15:54:00 2005 +0000
     2.3 @@ -22,7 +22,10 @@
     2.4  #define RANGE 3
     2.5  #define WIN_WIDTH 900
     2.6  #define WIN_HEIGHT 600
     2.7 -#define ALMOST_ONE 0.9999999999
     2.8 +#define MIN_EDGE_WIDTH 2
     2.9 +#define MAX_EDGE_WIDTH 40
    2.10 +#define MIN_NODE_RADIUS 2
    2.11 +#define MAX_NODE_RADIUS 80
    2.12  
    2.13  #ifndef MAIN_PART
    2.14  extern std::vector <std::string> edge_property_strings;
     3.1 --- a/graph_displayer_canvas-edge.cc	Thu Jul 28 14:31:32 2005 +0000
     3.2 +++ b/graph_displayer_canvas-edge.cc	Thu Jul 28 15:54:00 2005 +0000
     3.3 @@ -6,12 +6,18 @@
     3.4  int GraphDisplayerCanvas::changeEdgeWidth (std::string mapname, Graph::Edge edge)
     3.5  {
     3.6    Graph::EdgeMap<double> * actual_map;
     3.7 +  double min, max;
     3.8 +
     3.9    if(mapname=="Default")
    3.10      {
    3.11 +      min=edge_property_defaults[E_WIDTH];
    3.12 +      max=edge_property_defaults[E_WIDTH];
    3.13        actual_map=new Graph::EdgeMap<double>(g,edge_property_defaults[E_WIDTH]);
    3.14      }
    3.15    else
    3.16      {
    3.17 +      min=mapstorage.minOfEdgeMap(mapname);
    3.18 +      max=mapstorage.maxOfEdgeMap(mapname);
    3.19        actual_map=(mapstorage.edgemap_storage)[mapname];
    3.20      }
    3.21  
    3.22 @@ -19,11 +25,17 @@
    3.23      {
    3.24        for (EdgeIt i(g); i!=INVALID; ++i)
    3.25  	{
    3.26 -	  int w=(int)(*actual_map)[i];
    3.27 -	  if(w>=0)
    3.28 +	  double v=abs((*actual_map)[i]);
    3.29 +	  int w;
    3.30 +	  if(min==max)
    3.31  	    {
    3.32 -	      edgesmap[i]->property_width_units().set_value(w);
    3.33 +	      w=(int)(edge_property_defaults[E_WIDTH]);
    3.34  	    }
    3.35 +	  else
    3.36 +	    {
    3.37 +	      w=(int)(MIN_EDGE_WIDTH+(v-min)/(max-min)*(MAX_EDGE_WIDTH-MIN_EDGE_WIDTH));
    3.38 +	    }
    3.39 +	  edgesmap[i]->property_width_units().set_value(w);
    3.40  	}
    3.41      }
    3.42    else
     4.1 --- a/graph_displayer_canvas-event.cc	Thu Jul 28 14:31:32 2005 +0000
     4.2 +++ b/graph_displayer_canvas-event.cc	Thu Jul 28 15:54:00 2005 +0000
     4.3 @@ -216,7 +216,7 @@
     4.4  
     4.5        //draw the new node in red at the clicked place
     4.6      case GDK_2BUTTON_PRESS:
     4.7 -      std::cout << "double click" << std::endl;
     4.8 +      //std::cout << "double click" << std::endl;
     4.9        break;
    4.10      case GDK_BUTTON_PRESS:
    4.11        isbutton=1;
    4.12 @@ -381,7 +381,7 @@
    4.13  		  else
    4.14  		    {
    4.15  		      target_node=INVALID;
    4.16 -		      std::cout << "Loop edge is not yet implemented!" << std::endl;
    4.17 +		      std::cerr << "Loop edge is not yet implemented!" << std::endl;
    4.18  		    }
    4.19  		}
    4.20  	      //clicked item was not a node. it could be an e.g. edge. we do not deal with it furthermore.
    4.21 @@ -527,189 +527,225 @@
    4.22  
    4.23  bool GraphDisplayerCanvas::edgeMapEditEventHandler(GdkEvent* e)
    4.24  {
    4.25 -  switch(e->type)
    4.26 +  if(actual_tool==EDGE_MAP_EDIT)
    4.27      {
    4.28 -    case GDK_KEY_PRESS:
    4.29 -      //for Escape or Enter hide the displayed widget
    4.30 -      {
    4.31 -	nodeMapEditEventHandler(e);
    4.32 -	break;
    4.33 -      }
    4.34 -    case GDK_BUTTON_PRESS:
    4.35 -      //If the click happened on an edge we place the entrywidget there and fill in the value of the activated map at that edge.
    4.36 -      {
    4.37 -	//find the activated item
    4.38 -	window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
    4.39 -	active_item=(get_item_at(clicked_x, clicked_y));
    4.40 +      switch(e->type)
    4.41 +	{
    4.42 +	case GDK_KEY_PRESS:
    4.43 +	  //for Escape or Enter hide the displayed widget
    4.44 +	  {
    4.45 +	    nodeMapEditEventHandler(e);
    4.46 +	    break;
    4.47 +	  }
    4.48 +	case GDK_BUTTON_PRESS:
    4.49 +	  //If the click happened on an edge we place the entrywidget there and fill in the value of the activated map at that edge.
    4.50 +	  {
    4.51 +	    //for determine, whether it was an edge
    4.52 +	    Graph::EdgeIt clicked_edge=INVALID;
    4.53  
    4.54 -	//determine, whether it was an edge
    4.55 -	Graph::EdgeIt clicked_edge=INVALID;
    4.56 -	for (EdgeIt i(g); i!=INVALID; ++i)
    4.57 -	  {
    4.58 -	    if(edgesmap[i]==active_item)
    4.59 +	    //find the activated item between texts
    4.60 +	    active_item=(get_item_at(e->button.x, e->button.y));
    4.61 +	    for (EdgeIt i(g); i!=INVALID; ++i)
    4.62  	      {
    4.63 -		clicked_edge=i;
    4.64 +		if(edgetextmap[i]==active_item)
    4.65 +		  {
    4.66 +		    clicked_edge=i;
    4.67 +		  }
    4.68  	      }
    4.69 -	  }
    4.70 -	//if it was really an edge...
    4.71 -	if(clicked_edge!=INVALID)
    4.72 -	  {
    4.73 -	    //If there is already edited edge, it has to be saved first
    4.74 -	    if(entrywidget.is_visible())
    4.75 +
    4.76 +	    //if it was not between texts, search for it between edges
    4.77 +	    if(clicked_edge==INVALID)
    4.78  	      {
    4.79 +		window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
    4.80 +		active_item=(get_item_at(clicked_x, clicked_y));
    4.81 +
    4.82 +		for (EdgeIt i(g); i!=INVALID; ++i)
    4.83 +		  {
    4.84 +		    //at the same time only one can be active
    4.85 +		    if((edgesmap[i]==active_item)||(edgetextmap[i]==active_item))
    4.86 +		      {
    4.87 +			clicked_edge=i;
    4.88 +		      }
    4.89 +		  }
    4.90 +	      }
    4.91 +	    //if it was really an edge...
    4.92 +	    if(clicked_edge!=INVALID)
    4.93 +	      {
    4.94 +		//If there is already edited edge, it has to be saved first
    4.95 +		if(entrywidget.is_visible())
    4.96 +		  {
    4.97 +		    GdkEvent * generated=new GdkEvent();
    4.98 +		    generated->type=GDK_KEY_PRESS;
    4.99 +		    ((GdkEventKey*)generated)->keyval=GDK_KP_Enter;
   4.100 +		    entryWidgetChangeHandler(generated);
   4.101 +		  }
   4.102 +		//If the previous value could be saved, we can go further, otherwise not
   4.103 +		if(!entrywidget.is_visible())
   4.104 +		  {
   4.105 +		    //and there is activated map
   4.106 +		    if(edgetextmap[clicked_edge]->property_text().get_value()!="")
   4.107 +		      {
   4.108 +			//activate the general variable for it
   4.109 +			active_edge=clicked_edge;
   4.110 +			//delete visible widget if there is
   4.111 +			if(canvasentrywidget)
   4.112 +			  {
   4.113 +			    delete(canvasentrywidget);
   4.114 +			  }
   4.115 +
   4.116 +			//initialize the entry
   4.117 +			entrywidget.show();
   4.118 +
   4.119 +			//fill in the correct value
   4.120 +			entrywidget.set_text(edgetextmap[active_edge]->property_text().get_value());
   4.121 +
   4.122 +			//replace and resize the entry to the activated edge and put it in a Canvas::Widget to be able to display it on gdc
   4.123 +			xy<double> entry_coos;
   4.124 +			entry_coos.x=(edgetextmap[active_edge])->property_x().get_value();
   4.125 +			entry_coos.x-=edgetextmap[active_edge]->property_text_width().get_value()/2;
   4.126 +			entry_coos.y=(edgetextmap[active_edge])->property_y().get_value();
   4.127 +			entry_coos.y-=edgetextmap[active_edge]->property_text_height().get_value()*1.5/2;
   4.128 +			canvasentrywidget=new Gnome::Canvas::Widget(displayed_graph, entry_coos.x, entry_coos.y, entrywidget);
   4.129 +			canvasentrywidget->property_width().set_value(edgetextmap[active_edge]->property_text_width().get_value()*4);
   4.130 +			canvasentrywidget->property_height().set_value(edgetextmap[active_edge]->property_text_height().get_value()*1.5);
   4.131 +		      }
   4.132 +		  }
   4.133 +	      }
   4.134 +	    //if it was not an edge...
   4.135 +	    else
   4.136 +	      {
   4.137 +		//In this case the click did not happen on an edge
   4.138 +		//if there is visible entry we save the value in it
   4.139 +		//we pretend like an Enter was presse din the Entry widget
   4.140  		GdkEvent * generated=new GdkEvent();
   4.141  		generated->type=GDK_KEY_PRESS;
   4.142  		((GdkEventKey*)generated)->keyval=GDK_KP_Enter;
   4.143  		entryWidgetChangeHandler(generated);
   4.144  	      }
   4.145 -	    //If the previous value could be saved, we can go further, otherwise not
   4.146 -	    if(!entrywidget.is_visible())
   4.147 -	      {
   4.148 -		//and there is activated map
   4.149 -		if(edgetextmap[clicked_edge]->property_text().get_value()!="")
   4.150 -		  {
   4.151 -		    //activate the general variable for it
   4.152 -		    active_edge=clicked_edge;
   4.153 -		    //delete visible widget if there is
   4.154 -		    if(canvasentrywidget)
   4.155 -		      {
   4.156 -			delete(canvasentrywidget);
   4.157 -		      }
   4.158 -
   4.159 -		    //initialize the entry
   4.160 -		    entrywidget.show();
   4.161 -
   4.162 -		    //fill in the correct value
   4.163 -		    entrywidget.set_text(edgetextmap[active_edge]->property_text().get_value());
   4.164 -
   4.165 -		    //replace and resize the entry to the activated edge and put it in a Canvas::Widget to be able to display it on gdc
   4.166 -		    xy<double> entry_coos;
   4.167 -		    entry_coos.x=(edgetextmap[active_edge])->property_x().get_value();
   4.168 -		    entry_coos.x-=edgetextmap[active_edge]->property_text_width().get_value()/2;
   4.169 -		    entry_coos.y=(edgetextmap[active_edge])->property_y().get_value();
   4.170 -		    entry_coos.y-=edgetextmap[active_edge]->property_text_height().get_value()*1.5/2;
   4.171 -		    canvasentrywidget=new Gnome::Canvas::Widget(displayed_graph, entry_coos.x, entry_coos.y, entrywidget);
   4.172 -		    canvasentrywidget->property_width().set_value(edgetextmap[active_edge]->property_text_width().get_value()*4);
   4.173 -		    canvasentrywidget->property_height().set_value(edgetextmap[active_edge]->property_text_height().get_value()*1.5);
   4.174 -		  }
   4.175 -	      }
   4.176 +	    break;
   4.177  	  }
   4.178 -	//if it was not an edge...
   4.179 -	else
   4.180 -	  {
   4.181 -	    //In this case the click did not happen on an edge
   4.182 -	    //if there is visible entry we save the value in it
   4.183 -	    //we pretend like an Enter was presse din the Entry widget
   4.184 -	    GdkEvent * generated=new GdkEvent();
   4.185 -	    generated->type=GDK_KEY_PRESS;
   4.186 -	    ((GdkEventKey*)generated)->keyval=GDK_KP_Enter;
   4.187 -	    entryWidgetChangeHandler(generated);
   4.188 -	  }
   4.189 -	break;
   4.190 -      }
   4.191 -    default:
   4.192 -      break;
   4.193 +	default:
   4.194 +	  break;
   4.195 +	}
   4.196      }
   4.197    return false;  
   4.198  }
   4.199  
   4.200  bool GraphDisplayerCanvas::nodeMapEditEventHandler(GdkEvent* e)
   4.201  {
   4.202 -  switch(e->type)
   4.203 +  if(actual_tool==NODE_MAP_EDIT)
   4.204      {
   4.205 -    case GDK_KEY_PRESS:
   4.206 -      //for Escape or Enter hide the displayed widget
   4.207 -      {
   4.208 -	switch(((GdkEventKey*)e)->keyval)
   4.209 +      switch(e->type)
   4.210 +	{
   4.211 +	case GDK_KEY_PRESS:
   4.212 +	  //for Escape or Enter hide the displayed widget
   4.213  	  {
   4.214 -	  case GDK_Escape:
   4.215 -	    entrywidget.hide();
   4.216 -	    break;
   4.217 -	  case GDK_Return:
   4.218 -	  case GDK_KP_Enter:
   4.219 -	    entrywidget.hide();
   4.220 -	    break;
   4.221 -	  default:
   4.222 +	    switch(((GdkEventKey*)e)->keyval)
   4.223 +	      {
   4.224 +	      case GDK_Escape:
   4.225 +		entrywidget.hide();
   4.226 +		break;
   4.227 +	      case GDK_Return:
   4.228 +	      case GDK_KP_Enter:
   4.229 +		entrywidget.hide();
   4.230 +		break;
   4.231 +	      default:
   4.232 +		break;
   4.233 +	      }
   4.234 +  
   4.235  	    break;
   4.236  	  }
   4.237 -  
   4.238 -	break;
   4.239 -      }
   4.240 -    case GDK_BUTTON_PRESS:
   4.241 -      //If the click happened on an edge we place the entrywidget there and fill in the value of the activated map at that edge.
   4.242 -      {
   4.243 -	//find the activated item
   4.244 -	window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
   4.245 -	active_item=(get_item_at(clicked_x, clicked_y));
   4.246 +	case GDK_BUTTON_PRESS:
   4.247 +	  //If the click happened on an edge we place the entrywidget there and fill in the value of the activated map at that edge.
   4.248 +	  {
   4.249 +	    //for determine, whether it was a node
   4.250 +	    Graph::NodeIt clicked_node=INVALID;
   4.251  
   4.252 -	//determine, whether it was a node
   4.253 -	Graph::NodeIt clicked_node=INVALID;
   4.254 -	for (NodeIt i(g); i!=INVALID; ++i)
   4.255 -	  {
   4.256 -	    if(nodesmap[i]==active_item)
   4.257 +	    //find the activated item between texts
   4.258 +	    active_item=(get_item_at(e->button.x, e->button.y));
   4.259 +	    for (NodeIt i(g); i!=INVALID; ++i)
   4.260  	      {
   4.261 -		clicked_node=i;
   4.262 +		//at the same time only one can be active
   4.263 +		if(nodetextmap[i]==active_item)
   4.264 +		  {
   4.265 +		    clicked_node=i;
   4.266 +		  }
   4.267  	      }
   4.268 -	  }
   4.269  
   4.270 -	//if it was really an edge...
   4.271 -	if(clicked_node!=INVALID)
   4.272 -	  {
   4.273 -	    //If there is already edited edge, it has to be saved first
   4.274 -	    if(entrywidget.is_visible())
   4.275 +	    //if there was not, search for it between nodes
   4.276 +	    if(clicked_node==INVALID)
   4.277  	      {
   4.278 +		window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
   4.279 +		active_item=(get_item_at(clicked_x, clicked_y));
   4.280 +
   4.281 +		for (NodeIt i(g); i!=INVALID; ++i)
   4.282 +		  {
   4.283 +		    //at the same time only one can be active
   4.284 +		    if(nodesmap[i]==active_item)
   4.285 +		      {
   4.286 +			clicked_node=i;
   4.287 +		      }
   4.288 +		  }
   4.289 +	      }
   4.290 +	    //if it was really an edge...
   4.291 +	    if(clicked_node!=INVALID)
   4.292 +	      {
   4.293 +		//If there is already edited edge, it has to be saved first
   4.294 +		if(entrywidget.is_visible())
   4.295 +		  {
   4.296 +		    GdkEvent * generated=new GdkEvent();
   4.297 +		    generated->type=GDK_KEY_PRESS;
   4.298 +		    ((GdkEventKey*)generated)->keyval=GDK_KP_Enter;
   4.299 +		    entryWidgetChangeHandler(generated);
   4.300 +		  }
   4.301 +		//If the previous value could be saved, we can go further, otherwise not
   4.302 +		if(!entrywidget.is_visible())
   4.303 +		  {
   4.304 +		    //and there is activated map
   4.305 +		    if(nodetextmap[clicked_node]->property_text().get_value()!="")
   4.306 +		      {
   4.307 +			//activate the general variable for it
   4.308 +			active_node=clicked_node;
   4.309 +			//delete visible widget if there is
   4.310 +			if(canvasentrywidget)
   4.311 +			  {
   4.312 +			    delete(canvasentrywidget);
   4.313 +			  }
   4.314 +
   4.315 +			//initialize the entry
   4.316 +			entrywidget.show();
   4.317 +
   4.318 +			//fill in the correct value
   4.319 +			entrywidget.set_text(nodetextmap[active_node]->property_text().get_value());
   4.320 +
   4.321 +			//replace and resize the entry to the activated node and put it in a Canvas::Widget to be able to display it on gdc
   4.322 +			xy<double> entry_coos;
   4.323 +			entry_coos.x=(nodetextmap[active_node])->property_x().get_value();
   4.324 +			entry_coos.x-=nodetextmap[active_node]->property_text_width().get_value()/2;
   4.325 +			entry_coos.y=(nodetextmap[active_node])->property_y().get_value();
   4.326 +			entry_coos.y-=nodetextmap[active_node]->property_text_height().get_value()*1.5/2;
   4.327 +			canvasentrywidget=new Gnome::Canvas::Widget(displayed_graph, entry_coos.x, entry_coos.y, entrywidget);
   4.328 +			canvasentrywidget->property_width().set_value(nodetextmap[active_node]->property_text_width().get_value()*4);
   4.329 +			canvasentrywidget->property_height().set_value(nodetextmap[active_node]->property_text_height().get_value()*1.5);
   4.330 +		      }
   4.331 +		  }
   4.332 +	      }
   4.333 +	    //if it was not an edge...
   4.334 +	    else
   4.335 +	      {
   4.336 +		//In this case the click did not happen on an edge
   4.337 +		//if there is visible entry we save the value in it
   4.338 +		//we pretend like an Enter was presse din the Entry widget
   4.339  		GdkEvent * generated=new GdkEvent();
   4.340  		generated->type=GDK_KEY_PRESS;
   4.341  		((GdkEventKey*)generated)->keyval=GDK_KP_Enter;
   4.342  		entryWidgetChangeHandler(generated);
   4.343  	      }
   4.344 -	    //If the previous value could be saved, we can go further, otherwise not
   4.345 -	    if(!entrywidget.is_visible())
   4.346 -	      {
   4.347 -		//and there is activated map
   4.348 -		if(nodetextmap[clicked_node]->property_text().get_value()!="")
   4.349 -		  {
   4.350 -		    //activate the general variable for it
   4.351 -		    active_node=clicked_node;
   4.352 -		    //delete visible widget if there is
   4.353 -		    if(canvasentrywidget)
   4.354 -		      {
   4.355 -			delete(canvasentrywidget);
   4.356 -		      }
   4.357 -
   4.358 -		    //initialize the entry
   4.359 -		    entrywidget.show();
   4.360 -
   4.361 -		    //fill in the correct value
   4.362 -		    entrywidget.set_text(nodetextmap[active_node]->property_text().get_value());
   4.363 -
   4.364 -		    //replace and resize the entry to the activated node and put it in a Canvas::Widget to be able to display it on gdc
   4.365 -		    xy<double> entry_coos;
   4.366 -		    entry_coos.x=(nodetextmap[active_node])->property_x().get_value();
   4.367 -		    entry_coos.x-=nodetextmap[active_node]->property_text_width().get_value()/2;
   4.368 -		    entry_coos.y=(nodetextmap[active_node])->property_y().get_value();
   4.369 -		    entry_coos.y-=nodetextmap[active_node]->property_text_height().get_value()*1.5/2;
   4.370 -		    canvasentrywidget=new Gnome::Canvas::Widget(displayed_graph, entry_coos.x, entry_coos.y, entrywidget);
   4.371 -		    canvasentrywidget->property_width().set_value(nodetextmap[active_node]->property_text_width().get_value()*1.5);
   4.372 -		    canvasentrywidget->property_height().set_value(nodetextmap[active_node]->property_text_height().get_value()*1.5);
   4.373 -		  }
   4.374 -	      }
   4.375 +	    break;
   4.376  	  }
   4.377 -	//if it was not an edge...
   4.378 -	else
   4.379 -	  {
   4.380 -	    //In this case the click did not happen on an edge
   4.381 -	    //if there is visible entry we save the value in it
   4.382 -	    //we pretend like an Enter was presse din the Entry widget
   4.383 -	    GdkEvent * generated=new GdkEvent();
   4.384 -	    generated->type=GDK_KEY_PRESS;
   4.385 -	    ((GdkEventKey*)generated)->keyval=GDK_KP_Enter;
   4.386 -	    entryWidgetChangeHandler(generated);
   4.387 -	  }
   4.388 -	break;
   4.389 -      }
   4.390 -    default:
   4.391 -      break;
   4.392 +	default:
   4.393 +	  break;
   4.394 +	}
   4.395      }
   4.396    return false;  
   4.397  }
   4.398 @@ -782,7 +818,7 @@
   4.399  		//the text in the entry was not correct for a double
   4.400  		else
   4.401  		  {
   4.402 -		    std::cout << "ERROR: only handling of double values is implemented yet!" << std::endl;
   4.403 +		    std::cerr << "ERROR: only handling of double values is implemented yet!" << std::endl;
   4.404  		  }
   4.405  
   4.406  		break;
   4.407 @@ -829,7 +865,7 @@
   4.408      {
   4.409        if(forming_edge!=INVALID)
   4.410  	{
   4.411 -	  std::cout << "ERROR!!!! Valid edge found!" << std::endl;
   4.412 +	  std::cerr << "ERROR!!!! Valid edge found!" << std::endl;
   4.413  	}
   4.414        else
   4.415  	{
   4.416 @@ -850,7 +886,7 @@
   4.417  	}
   4.418        else
   4.419  	{
   4.420 -	  std::cout << "ERROR!!!! Invalid edge found!" << std::endl;
   4.421 +	  std::cerr << "ERROR!!!! Invalid edge found!" << std::endl;
   4.422  	}
   4.423      }
   4.424  
     5.1 --- a/graph_displayer_canvas-node.cc	Thu Jul 28 14:31:32 2005 +0000
     5.2 +++ b/graph_displayer_canvas-node.cc	Thu Jul 28 15:54:00 2005 +0000
     5.3 @@ -6,12 +6,17 @@
     5.4  int GraphDisplayerCanvas::changeNodeRadius (std::string mapname, Graph::Node node)
     5.5  {
     5.6    Graph::NodeMap<double> * actual_map;
     5.7 +  double min, max;
     5.8    if(mapname=="Default")
     5.9      {
    5.10 +      min=node_property_defaults[N_RADIUS];
    5.11 +      max=node_property_defaults[N_RADIUS];
    5.12        actual_map=new Graph::NodeMap<double>(g,node_property_defaults[N_RADIUS]);
    5.13      }
    5.14    else
    5.15      {
    5.16 +      min=mapstorage.minOfNodeMap(mapname);
    5.17 +      max=mapstorage.maxOfNodeMap(mapname);
    5.18        actual_map=(mapstorage.nodemap_storage)[mapname];
    5.19      }
    5.20  
    5.21 @@ -19,7 +24,16 @@
    5.22      {
    5.23        for (NodeIt i(g); i!=INVALID; ++i)
    5.24  	{
    5.25 -	  int w=(int)(*actual_map)[i];
    5.26 +	  double v=abs((*actual_map)[i]);
    5.27 +	  int w;
    5.28 +	  if(min==max)
    5.29 +	    {
    5.30 +	      w=(int)(node_property_defaults[N_RADIUS]);
    5.31 +	    }
    5.32 +	  else
    5.33 +	    {
    5.34 +	      w=(int)(MIN_NODE_RADIUS+(v-min)/(max-min)*(MAX_NODE_RADIUS-MIN_NODE_RADIUS));
    5.35 +	    }
    5.36  	  if(w>=0)
    5.37  	    {
    5.38  	      double x1, y1, x2, y2;
     6.1 --- a/graph_displayer_canvas.cc	Thu Jul 28 14:31:32 2005 +0000
     6.2 +++ b/graph_displayer_canvas.cc	Thu Jul 28 15:54:00 2005 +0000
     6.3 @@ -41,6 +41,7 @@
     6.4  
     6.5      edgetextmap[i]=new Gnome::Canvas::Text(displayed_graph, text_pos.x, text_pos.y, "");
     6.6      edgetextmap[i]->property_fill_color().set_value("darkgreen");
     6.7 +    edgetextmap[i]->signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::edgeMapEditEventHandler), false);
     6.8    }
     6.9  
    6.10    //afterwards nodes come to be drawn
    6.11 @@ -69,6 +70,7 @@
    6.12  
    6.13      nodetextmap[i]=new Gnome::Canvas::Text(displayed_graph, text_pos.x, text_pos.y, "");
    6.14      nodetextmap[i]->property_fill_color().set_value("darkblue");
    6.15 +    nodetextmap[i]->signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::nodeMapEditEventHandler), false);
    6.16    }
    6.17  
    6.18    updateScrollRegion();
     7.1 --- a/map_win.cc	Thu Jul 28 14:31:32 2005 +0000
     7.2 +++ b/map_win.cc	Thu Jul 28 15:54:00 2005 +0000
     7.3 @@ -144,7 +144,7 @@
     7.4  	    gdc.changeEdgeText(mapname);
     7.5  	    break;
     7.6            default:
     7.7 -	    std::cout<<"Error\n";
     7.8 +	    std::cerr<<"Error\n";
     7.9  	}
    7.10        }
    7.11      }
    7.12 @@ -175,7 +175,7 @@
    7.13  	    gdc.changeNodeText(mapname);
    7.14  	    break;
    7.15            default:
    7.16 -	    std::cout<<"Error\n";
    7.17 +	    std::cerr<<"Error\n";
    7.18  	}
    7.19        }
    7.20      }
    7.21 @@ -207,7 +207,7 @@
    7.22  		      gdc.changeNodeText(mapname, node);
    7.23  		      break;
    7.24  		    default:
    7.25 -		      std::cout<<"Error\n";
    7.26 +		      std::cerr<<"Error\n";
    7.27  		    }
    7.28  		}
    7.29  	    }
    7.30 @@ -242,7 +242,7 @@
    7.31  		      gdc.changeEdgeText(mapname, edge);
    7.32  		      break;
    7.33  		    default:
    7.34 -		      std::cout<<"Error\n";
    7.35 +		      std::cerr<<"Error\n";
    7.36  		    }
    7.37  		}
    7.38  	    }