Changeset 1444:5fcd69785959 in lemon-0.x
- Timestamp:
- 06/03/05 14:25:23 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1923
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gui/graph_displayer_canvas.cc
r1442 r1444 191 191 isbutton=false; 192 192 active_item=NULL; 193 updateScrollRegion(); 193 194 break; 194 195 case GDK_MOTION_NOTIFY: … … 284 285 aw -= 5; if (aw < 0) aw = 0; 285 286 ah -= 5; if (ah < 0) ah = 0; 286 //std::cout << "aw=" << aw << " ah=" << ah << std::endl;287 287 288 288 // get the bounding box of the graph 289 set_pixels_per_unit(1.0); // I don't really understand why this is necessary290 289 double wx1, wy1, wx2, wy2; 291 double cx1, cy1, cx2, cy2;292 290 Gnome::Canvas::Item* pCanvasItem = root(); 293 291 pCanvasItem->get_bounds(wx1, wy1, wx2, wy2); 294 //std::cout << "root bounds: " << wx1 << " " << wy1 << " " << wx2 << " " << wy2 << std::endl;295 w2c(wx1, wy1, cx1, cy1);296 w2c(wx2, wy2, cx2, cy2);297 //std::cout << "root bounds (c): " << cx1 << " " << cy1 << " " << cx2 << " " << cy2 << std::endl;298 //std::cout << "cx2 - cx1=" << fabs(cx2 - cx1) << " cy2 - cy1=" << fabs(cy2 - cy1) << std::endl;299 292 300 293 // fit the graph to the window 301 double ppu1 = (double) aw / fabs(cx2 - cx1); 302 double ppu2 = (double) ah / fabs(cy2 - cy1); 303 //std::cout << "ppu1=" << ppu1 << " ppu2=" << ppu2 << std::endl; 304 (ppu1 < ppu2) ? set_pixels_per_unit(ppu1) : set_pixels_per_unit(ppu2); 294 double ppu1 = (double) aw / fabs(wx2 - wx1); 295 double ppu2 = (double) ah / fabs(wy2 - wy1); 296 set_pixels_per_unit((ppu1 < ppu2) ? ppu1 : ppu2); 305 297 } 306 298 … … 313 305 { 314 306 double wx1, wy1, wx2, wy2; 315 int cx1, cy1, cx2, cy2;316 307 Gnome::Canvas::Item* pCanvasItem = root(); 317 308 pCanvasItem->get_bounds(wx1, wy1, wx2, wy2); 318 w2c(wx1, wy1, cx1, cy1); 319 w2c(wx2, wy2, cx2, cy2); 320 set_scroll_region(cx1, cy1, cx2, cy2); 321 } 309 set_scroll_region(wx1, wy1, wx2, wy2); 310 }
Note: See TracChangeset
for help on using the changeset viewer.