Add autopackage specfile (not yet working).
3 * This file is a part of LEMON, a generic C++ optimization library
5 * Copyright (C) 2003-2006
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
9 * Permission to use, modify and distribute this software is granted
10 * provided that this copyright notice appears in all copies. For
11 * precise terms see the accompanying LICENSE file.
13 * This software is provided "AS IS" with no warranty of any kind,
14 * express or implied, and with no claim as to its suitability for any
19 #include "graph_displayer_canvas.h"
22 void GraphDisplayerCanvas::zoomIn()
25 (1.0 + (double) zoom_step / 100.0) * get_pixels_per_unit());
28 propertyChange(false, N_RADIUS);
29 propertyChange(true, E_WIDTH);
33 void GraphDisplayerCanvas::zoomOut()
36 (1.0 - (double) zoom_step / 100.0) * get_pixels_per_unit());
39 propertyChange(true, E_WIDTH);
40 propertyChange(false, N_RADIUS);
44 void GraphDisplayerCanvas::zoomFit()
48 // get the height and width of the canvas
49 Gtk::Allocation a = get_allocation();
50 int aw = a.get_width();
51 int ah = a.get_height();
53 // get the bounding box of the graph
55 double x1, y1, x2, y2;
56 root()->get_bounds(x1, y1, x2, y2);
58 // fit the graph to the window
59 double ppu1 = (double) aw / fabs(x2 - x1);
60 double ppu2 = (double) ah / fabs(y2 - y1);
61 set_pixels_per_unit((ppu1 < ppu2) ? ppu1 : ppu2);
65 propertyChange(true, E_WIDTH);
66 propertyChange(false, N_RADIUS);
70 void GraphDisplayerCanvas::zoom100()
73 set_pixels_per_unit(1.0);
77 propertyChange(true, E_WIDTH);
78 propertyChange(false, N_RADIUS);
82 void GraphDisplayerCanvas::updateScrollRegion()
84 // get_bounds() yields something sane only when no updates are pending
85 // and it returns a sufficient, not an exact bounding box
87 double x1, y1, x2, y2;
88 root()->get_bounds(x1, y1, x2, y2);
89 set_scroll_region(x1, y1, x2, y2);