private void OnPlotSelectionChanged(object o, EventArgs args) { if (freeze_selection) { return; } LinePlot p = o as LinePlot; if (p == null) { return; } TreeIter iter; TreeModel model; if (!p.GetSelected(out model, out iter)) { UnselectAll(); return; } int x, y; GetPlotPoint(p, iter, out x, out y); x -= Allocation.X; y -= Allocation.Y; SelectPointsNear(p, x, y, false); }
public void Draw(Cairo.Context cr) { if (Allocation.Width == 0 && Allocation.Height == 0) { return; } if (x_axis == null || y_axis == null) { return; } int selection_x = -1; if (has_selection && selected_plots.Count > 0) { // get the x of the first focused point, and // then draw a line from top to bottom // connecting all focused points LinePlot first_plot = (LinePlot)selected_plots[0]; TreeIter iter; TreeModel model; first_plot.GetSelected(out model, out iter); int x, y; GetPlotPoint(first_plot, iter, out x, out y); style.DrawLinkedSelectionLine(cr, x, Allocation.Y, x, Allocation.Y + Allocation.Height); selection_x = x; } if (has_focus && focused_plots.Count > 0) { // get the x of the first focused point, and // then draw a line from top to bottom // connecting all focused points LinePlot first_plot = (LinePlot)focused_plots[0]; TreeIter iter; TreeModel model; first_plot.GetFocused(out model, out iter); int x, y; GetPlotPoint(first_plot, iter, out x, out y); if (x != selection_x) { style.DrawLinkedFocusLine(cr, x, Allocation.Y, x, Allocation.Y + Allocation.Height); } } foreach (LinePlot plot in plots) { plot.SizeAllocate(Allocation); plot.SetAxes(axes); plot.Draw(cr); } }