Changeset 26:b0c76a4d5801 in glemon-0.x for graph_displayer_canvas.cc
- Timestamp:
- 06/23/05 19:56:24 (18 years ago)
- Branch:
- gui
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk/gui@1992
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
graph_displayer_canvas.cc
r25 r26 96 96 { 97 97 for (EdgeIt i(g); i!=INVALID; ++i) 98 { 99 int w=(int)(*(mapstorage.edgemap_storage)[mapname])[i]; 100 edgesmap[i]->property_width_pixels().set_value(w); 101 } 98 { 99 int w=(int)(*(mapstorage.edgemap_storage)[mapname])[i]; 100 if(w>=0) 101 { 102 edgesmap[i]->property_width_pixels().set_value(w); 103 } 104 } 102 105 return 0; 103 106 }; … … 142 145 143 146 for (EdgeIt i(g); i!=INVALID; ++i) 144 { 145 if(mapname!="Text") 146 { 147 double number=(*(mapstorage.edgemap_storage)[mapname])[i]; 148 int length=(int)(floor(log(number)/log(10)))+1; 149 int maxpos=(int)(pow(10,length-1)); 150 int strl=length+1+RANGE; 151 char * str=new char[strl]; 152 str[length]='.'; 153 str[strl]='\0'; 147 { 148 if(mapname!="Text") 149 { 150 double number=(*(mapstorage.edgemap_storage)[mapname])[i]; 151 int length=1; 152 //if number is smaller than one, length would be negative, or invalid 153 if(number>=1) 154 { 155 length=(int)(floor(log(number)/log(10)))+1; 156 } 157 int maxpos=(int)(pow(10,length-1)); 158 int strl=length+1+RANGE; 159 char * str=new char[strl]; 160 str[length]='.'; 161 str[strl]='\0'; 154 162 155 156 157 if(j!=length)158 159 int digit=(int)(number/maxpos);160 str[j]=(digit+'0');161 number-=digit*maxpos;162 number*=10;163 164 163 for(int j=0;j<strl;j++) 164 { 165 if(j!=length) 166 { 167 int digit=(int)(number/maxpos); 168 str[j]=(digit+'0'); 169 number-=digit*maxpos; 170 number*=10; 171 } 172 } 165 173 166 167 168 else169 170 171 172 }174 edgetextmap[i]->property_text().set_value(str); 175 } 176 else 177 { 178 edgetextmap[i]->property_text().set_value(""); 179 } 180 } 173 181 return 0; 174 182 }; … … 475 483 476 484 active_node=NodeIt(g,g.addNode()); 485 486 //initiating values corresponding to new node in maps 487 477 488 478 489 window_to_world (e->button.x, e->button.y, clicked_x, clicked_y); … … 517 528 { 518 529 case GDK_BUTTON_PRESS: 519 //in edge creati noright button has special meaning530 //in edge creation right button has special meaning 520 531 if(e->button.button!=3) 521 532 { … … 570 581 //creating new edge 571 582 active_edge=EdgeIt(g,g.addEdge(active_node, target_node)); 583 584 //initiating values corresponding to new edge in maps 585 mapstorage.init_maps_for_edge(active_edge); 572 586 573 587 //calculating coordinates of new edge
Note: See TracChangeset
for help on using the changeset viewer.