[Lemon-commits] [lemon_svn] ladanyi: r1923 - hugo/trunk/gui
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:48:49 CET 2006
Author: ladanyi
Date: Fri Jun 3 14:25:23 2005
New Revision: 1923
Modified:
hugo/trunk/gui/graph_displayer_canvas.cc
Log:
zooming should really work now
Modified: hugo/trunk/gui/graph_displayer_canvas.cc
==============================================================================
--- hugo/trunk/gui/graph_displayer_canvas.cc (original)
+++ hugo/trunk/gui/graph_displayer_canvas.cc Fri Jun 3 14:25:23 2005
@@ -190,6 +190,7 @@
case GDK_BUTTON_RELEASE:
isbutton=false;
active_item=NULL;
+ updateScrollRegion();
break;
case GDK_MOTION_NOTIFY:
//we only have to do sg. if the mouse button is pressed
@@ -283,25 +284,16 @@
// add some space
aw -= 5; if (aw < 0) aw = 0;
ah -= 5; if (ah < 0) ah = 0;
- //std::cout << "aw=" << aw << " ah=" << ah << std::endl;
// get the bounding box of the graph
- set_pixels_per_unit(1.0); // I don't really understand why this is necessary
double wx1, wy1, wx2, wy2;
- double cx1, cy1, cx2, cy2;
Gnome::Canvas::Item* pCanvasItem = root();
pCanvasItem->get_bounds(wx1, wy1, wx2, wy2);
- //std::cout << "root bounds: " << wx1 << " " << wy1 << " " << wx2 << " " << wy2 << std::endl;
- w2c(wx1, wy1, cx1, cy1);
- w2c(wx2, wy2, cx2, cy2);
- //std::cout << "root bounds (c): " << cx1 << " " << cy1 << " " << cx2 << " " << cy2 << std::endl;
- //std::cout << "cx2 - cx1=" << fabs(cx2 - cx1) << " cy2 - cy1=" << fabs(cy2 - cy1) << std::endl;
// fit the graph to the window
- double ppu1 = (double) aw / fabs(cx2 - cx1);
- double ppu2 = (double) ah / fabs(cy2 - cy1);
- //std::cout << "ppu1=" << ppu1 << " ppu2=" << ppu2 << std::endl;
- (ppu1 < ppu2) ? set_pixels_per_unit(ppu1) : set_pixels_per_unit(ppu2);
+ double ppu1 = (double) aw / fabs(wx2 - wx1);
+ double ppu2 = (double) ah / fabs(wy2 - wy1);
+ set_pixels_per_unit((ppu1 < ppu2) ? ppu1 : ppu2);
}
void GraphDisplayerCanvas::zoom100()
@@ -312,10 +304,7 @@
void GraphDisplayerCanvas::updateScrollRegion()
{
double wx1, wy1, wx2, wy2;
- int cx1, cy1, cx2, cy2;
Gnome::Canvas::Item* pCanvasItem = root();
pCanvasItem->get_bounds(wx1, wy1, wx2, wy2);
- w2c(wx1, wy1, cx1, cy1);
- w2c(wx2, wy2, cx2, cy2);
- set_scroll_region(cx1, cy1, cx2, cy2);
+ set_scroll_region(wx1, wy1, wx2, wy2);
}
More information about the Lemon-commits
mailing list