Пример #1
0
        public static Surface CreateSurface(Gdk.Drawable d)
        {
            int width, height;

            d.GetSize(out width, out height);
            XlibSurface surface = new XlibSurface(GdkUtils.GetXDisplay(d.Display),
                                                  (IntPtr)GdkUtils.GetXid(d),
                                                  GdkUtils.GetXVisual(d.Visual),
                                                  width, height);

            return(surface);
        }
Пример #2
0
        public Gdk(GGdk.Drawable drawable)
        {
            d_drawable = drawable;

            int width;
            int height;

            d_drawable.GetSize(out width, out height);

            Width  = width;
            Height = height;
        }
Пример #3
0
            public void draw(Gdk.Drawable da, string datasubtype, bool autoscale = false, double tMin = 0, bool manualscaleMin = false, double manualMin = -999999, bool manualscaleMax = false, double manualMax = 99999999)
            {
                try {
                    if (data == null)
                    {
                        return;
                    }

                    if (time.Count < 5)
                    {
                        return;
                    }

                    int width, height;
                    da.GetSize(out width, out height);

                    double maxY, minY;
                    minY = 99999; maxY = -99999;


                    int startIdx = 0;
                    for (int sIdx = 0; sIdx < this.time.Count; sIdx++)
                    {
                        if (this.time[sIdx] <= tMin)
                        {
                            startIdx = sIdx;
                        }
                    }

                    int skip = (int)Math.Max(1, Math.Floor((double)((this.time.Count - startIdx) / 1000)));


                    if (this.probe.measlistAct == null)
                    {
                        this.probe.measlistAct = new bool[this.probe.ChannelMap.Length];
                        for (int i = 0; i < this.probe.ChannelMap.Length; i++)
                        {
                            this.probe.measlistAct[i] = false;
                        }
                        this.probe.measlistAct[0] = true;
                    }



                    for (int i = 0; i < this.probe.ChannelMap.Length; i++)
                    {
                        for (int j = startIdx; j < this.data[i].Count; j++)
                        {
                            if (this.probe.ChannelMap[i].datasubtype.ToLower().Equals(datasubtype.ToLower()))
                            {
                                if (this.probe.measlistAct[i])
                                {
                                    double d = this.data[i][j]; // Only shown data will define the scale
                                    if (maxY < d)
                                    {
                                        maxY = d;
                                    }
                                    if (minY > d)
                                    {
                                        minY = d;
                                    }
                                }
                                else if (!autoscale)   // This will include all the data in defining the scale
                                {
                                    double d = this.data[i][j];
                                    if (maxY < d)
                                    {
                                        maxY = d;
                                    }
                                    if (minY > d)
                                    {
                                        minY = d;
                                    }
                                }
                            }
                        }
                    }

                    if (manualscaleMax)
                    {
                        maxY = manualMax;
                    }
                    if (manualscaleMin)
                    {
                        minY = manualMin;
                    }
                    double rangeY  = maxY - minY;
                    double rangeX  = this.time[this.time.Count - 1] - this.time[startIdx];
                    int    xoffset = 50;
                    int    yoffset = 1;

                    height = height - 31;
                    width  = width - 51;

                    Gdk.GC gc = new Gdk.GC(da);

                    gc.RgbBgColor = new Gdk.Color(0, 0, 0);
                    gc.RgbFgColor = new Gdk.Color(0, 0, 0);
                    Rectangle rarea = new Rectangle();
                    rarea.X      = xoffset - 1;
                    rarea.Y      = yoffset - 1;
                    rarea.Height = height + 2;
                    rarea.Width  = width + 2;
                    da.DrawRectangle(gc, true, rarea);

                    gc.RgbBgColor = new Color(0, 0, 0);
                    gc.RgbFgColor = new Color(255, 255, 255);
                    rarea         = new Rectangle();
                    rarea.X       = xoffset;
                    rarea.Y       = yoffset;
                    rarea.Height  = height;
                    rarea.Width   = width;
                    da.DrawRectangle(gc, true, rarea);


                    gc.SetLineAttributes(2, LineStyle.Solid, CapStyle.Projecting, JoinStyle.Round);

                    // Draw stim events

                    for (int j = 0; j < stimulus.Count; j++)
                    {
                        gc.RgbFgColor = stimcolor[j];
                        Rectangle area = new Rectangle();


                        for (int k = 0; k < stimulus[j].onsets.Count; k++)
                        {
                            if (stimulus[j].amplitude[k] > 0 & stimulus[j].onsets[k] + stimulus[j].duration[k] >= this.time[startIdx])
                            {
                                area.Width = (int)(stimulus[j].duration[k] / rangeX * width);
                                if (area.Width == 0)
                                {
                                    area.Width = 1;
                                }
                                area.Height = height;
                                area.X      = (int)(xoffset + Math.Max((stimulus[j].onsets[k] - this.time[startIdx]), 0) / rangeX * width);
                                area.Y      = yoffset;
                                da.DrawRectangle(gc, true, area);
                            }
                            //da.DrawLine(gc,(int)x+xoffset,yoffset,(int)x+xoffset,(int)height+yoffset);
                        }
                    }



                    gc.SetLineAttributes(1, LineStyle.Solid, CapStyle.Projecting, JoinStyle.Round);
                    for (int i = 0; i < this.probe.ChannelMap.Length; i++)
                    {
                        if (this.probe.measlistAct[i] & this.probe.ChannelMap[i].datasubtype.Equals(datasubtype))
                        {
                            gc.RgbFgColor = this.probe.colormap[i];
                            for (int j = 0; j < this.probe.ChannelMap.Length; j++)
                            {
                                if (this.probe.ChannelMap[i].sourceindex == this.probe.ChannelMap[j].sourceindex &
                                    this.probe.ChannelMap[i].detectorindex == this.probe.ChannelMap[j].detectorindex &
                                    this.probe.ChannelMap[j].datasubtype.Equals(this.probe.ChannelMap[0].datasubtype))
                                {
                                    gc.RgbFgColor = this.probe.colormap[j];
                                    break;
                                }
                            }

                            for (int j = startIdx + skip; j < Math.Min(this.data[i].Count, this.time.Count); j = j + skip)
                            {
                                double y2 = (this.data[i][j] - minY) / rangeY * height;
                                double y1 = (this.data[i][j - skip] - minY) / rangeY * height;

                                double x2 = (this.time[j] - this.time[startIdx]) / rangeX * width;
                                double x1 = (this.time[j - skip] - this.time[startIdx]) / rangeX * width;

                                da.DrawLine(gc, (int)x1 + xoffset, (int)(height - y1 + yoffset), (int)x2 + xoffset, (int)(height - y2 + yoffset));
                            }
                        }
                    }


                    if (stimulus.Count > 0)
                    {
                        // add legend to window
                        int w = 0;
                        int h = 0;

                        int maxw = 0;

                        for (int j = 0; j < stimulus.Count; j++)
                        {
                            Gtk.Label lab = new Gtk.Label();
                            gc.RgbFgColor = stimcolor[j];
                            lab.Text      = stimulus[j].name;
                            da.DrawLayout(gc, xoffset + 10, yoffset + j * 10 + 10, lab.Layout);
                            lab.Layout.GetPixelSize(out w, out h);
                            if (w > maxw)
                            {
                                maxw = w;
                            }
                        }
                        gc.RgbBgColor = new Gdk.Color(0, 0, 0);
                        gc.RgbFgColor = new Gdk.Color(0, 0, 0);
                        rarea         = new Rectangle();
                        rarea.X       = xoffset + 4;
                        rarea.Y       = yoffset + 4;
                        rarea.Height  = stimulus.Count * 10 + 12;
                        rarea.Width   = maxw + 12;
                        da.DrawRectangle(gc, true, rarea);

                        gc.RgbBgColor = new Gdk.Color(0, 0, 0);
                        gc.RgbFgColor = new Gdk.Color(255, 255, 255);
                        rarea         = new Rectangle();
                        rarea.X       = xoffset + 5;
                        rarea.Y       = yoffset + 5;
                        rarea.Height  = stimulus.Count * 10 + 10;
                        rarea.Width   = maxw + 10;
                        da.DrawRectangle(gc, true, rarea);
                        for (int j = 0; j < stimulus.Count; j++)
                        {
                            Gtk.Label lab = new Gtk.Label();
                            gc.RgbFgColor = stimcolor[j];
                            lab.Text      = stimulus[j].name;
                            da.DrawLayout(gc, xoffset + 10, yoffset + j * 10 + 10, lab.Layout);
                        }
                    }

                    gc.RgbFgColor = new Gdk.Color(0, 0, 0);
                    int numxlabels = 10;
                    int numylabels = 5;

                    // Add Xtick marks to the graph
                    double tstart, tend, dt;
                    tstart = this.time[startIdx];
                    tend   = this.time[this.time.Count - 1];
                    dt     = Math.Round((tend - tstart) / (1 + numxlabels));

                    if (dt < 1)
                    {
                        dt = 1;
                    }

                    for (double i = 0; i < rangeX; i += dt)
                    {
                        double    x   = i / rangeX * width;
                        Gtk.Label lab = new Gtk.Label();
                        lab.Text = String.Format("{0}", Math.Round((tstart + i) * 10) / 10);
                        da.DrawLayout(gc, (int)x + xoffset, (int)height + 2, lab.Layout);
                    }

                    double dy;
                    dy = rangeY / (1 + numylabels);

                    if (dy == 0.0)
                    {
                        dy = 1;
                    }

                    for (double i = 0; i < rangeY; i += dy)
                    {
                        double    y   = height - i / rangeY * height;
                        Gtk.Label lab = new Gtk.Label();
                        lab.Text = String.Format("{0}", Math.Round((i + minY) * 10) / 10);
                        da.DrawLayout(gc, 10, (int)y + yoffset, lab.Layout);
                    }
                }
                catch
                {
                    Console.WriteLine("Internal data draw failed");
                }
            }
Пример #4
0
            public void draw1020(Gdk.Drawable da)
            {
                if (!this.isregistered)
                {
                    draw(da);
                    return;
                }

                double headcirc = 0;

                double[,] lsrcpos = project1020(this.SrcPos3D, this.numSrc, out headcirc);
                double[,] ldetpos = project1020(this.DetPos3D, this.numDet, out headcirc);

                int width, height;

                da.GetSize(out width, out height);

                double dx, dy;

                dx     = 10;
                dy     = 10;
                width  = width - 20;
                height = height - 20;

                double maxX = headcirc * 1.2;
                double minX = -1 * headcirc * 1.2;
                double maxY = headcirc * 1.2;
                double minY = -1 * headcirc * 1.2;


                ROIdrawPos = new double[ROIs.Count, 2];
                for (int i = 0; i < ROIs.Count; i++)
                {
                    ROIdrawPos[i, 0] = minX - .1 * headcirc;
                    ROIdrawPos[i, 1] = minY - .2 * (i) * headcirc;
                }
                if (ROIs.Count > 0)
                {
                    minY = minY - (ROIs.Count) * .2 * headcirc;
                    minX = minX - .1 * headcirc;
                }

                double rangeX = maxX - minX;
                double rangeY = maxY - minY;

                Gdk.GC gc = new Gdk.GC(da);

                gc.RgbBgColor = new Gdk.Color(0, 0, 0);
                gc.RgbFgColor = new Gdk.Color(0, 0, 0);
                Rectangle rarea = new Rectangle();

                rarea.Height = height + 20;
                rarea.Width  = width + 20;
                da.DrawRectangle(gc, true, rarea);

                gc.RgbBgColor = new Gdk.Color(0, 0, 0);
                gc.RgbFgColor = new Gdk.Color(255, 255, 255);
                rarea         = new Rectangle();
                rarea.Height  = height + 18;
                rarea.Width   = width + 18;
                rarea.X       = 1;
                rarea.Y       = 1;

                da.DrawRectangle(gc, true, rarea);

                int sz = 10;

                if (this.measlistAct == null)
                {
                    this.measlistAct = new bool[this.ChannelMap.Length];
                    for (int i = 0; i < this.ChannelMap.Length; i++)
                    {
                        this.measlistAct[i] = false;
                    }
                    this.measlistAct[0] = true;
                }


                gc.RgbFgColor = new Gdk.Color(0, 0, 0);
                gc.SetLineAttributes(3, LineStyle.Solid, CapStyle.Projecting, JoinStyle.Round);
                for (int i = 0; i < this.numChannels; i++)
                {
                    if (this.ChannelMap[i].datasubtype.Equals(this.ChannelMap[0].datasubtype))
                    {
                        if (this.measlistAct[i])
                        {
                            gc.RgbFgColor = colormap[i]; //new Gdk.Color (0, 0, 0);
                        }
                        else
                        {
                            gc.RgbFgColor = new Gdk.Color(230, 230, 230);
                        }
                        int si = this.ChannelMap[i].sourceindex;
                        int di = this.ChannelMap[i].detectorindex;

                        double x1 = (ldetpos[di, 0] - minX) / rangeX * width + dx;
                        double y1 = (ldetpos[di, 1] - minY) / rangeY * height + dy;
                        double x2 = (lsrcpos[si, 0] - minX) / rangeX * width + dx;
                        double y2 = (lsrcpos[si, 1] - minY) / rangeY * height + dy;
                        da.DrawLine(gc, (int)x1, (int)y1, (int)x2, (int)y2);
                        //pts[cnt]=new Gdk.Point((int)x,(int)y);
                    }
                }


                gc.RgbFgColor = new Gdk.Color(0, 255, 0);
                gc.SetLineAttributes(3, LineStyle.Solid, CapStyle.Round, JoinStyle.Round);
                //  Gdk.Point[] pts = new Gdk.Point[this.numdet+this.numsrc];
                for (int i = 0; i < this.numDet; i++)
                {
                    double x = (ldetpos[i, 0] - minX) / rangeX * width + dx - sz / 2;
                    double y = (ldetpos[i, 1] - minY) / rangeY * height + dy - sz / 2;
                    da.DrawArc(gc, true, (int)x, (int)y, sz, sz, 0, 360 * 64);
                    //pts[cnt]=new Gdk.Point((int)x,(int)y);
                }
                gc.RgbFgColor = new Gdk.Color(0, 0, 0);
                for (int i = 0; i < this.numDet; i++)
                {
                    double x = (ldetpos[i, 0] - minX) / rangeX * width + dx - sz / 2;
                    double y = (ldetpos[i, 1] - minY) / rangeY * height + dy - sz / 2;

                    Gtk.Label lab = new Gtk.Label();
                    lab.Text = string.Format("D{0}", i + 1);
                    da.DrawLayout(gc, (int)x, (int)y, lab.Layout);
                }


                gc.RgbBgColor = new Gdk.Color(0, 255, 0);
                gc.RgbFgColor = new Gdk.Color(255, 0, 0);
                gc.SetLineAttributes(3, LineStyle.Solid, CapStyle.Round, JoinStyle.Round);
                for (int i = 0; i < this.numSrc; i++)
                {
                    double x = (lsrcpos[i, 0] - minX) / rangeX * width + dx - sz / 2;
                    double y = (lsrcpos[i, 1] - minY) / rangeY * height + dy - sz / 2;
                    da.DrawArc(gc, true, (int)x, (int)y, sz, sz, 0, 360 * 64);
                }


                gc.RgbFgColor = new Gdk.Color(0, 0, 0);
                for (int i = 0; i < this.numSrc; i++)
                {
                    double x = (lsrcpos[i, 0] - minX) / rangeX * width + dx - sz / 2;
                    double y = (lsrcpos[i, 1] - minY) / rangeY * height + dy - sz / 2;

                    Gtk.Label lab = new Gtk.Label();
                    lab.Text = string.Format("S{0}", i + 1);
                    da.DrawLayout(gc, (int)x, (int)y, lab.Layout);
                }

                gc.RgbBgColor = new Gdk.Color(0, 0, 0);
                gc.RgbFgColor = new Gdk.Color(0, 0, 0);
                double xx = (0) / rangeX * width + dx;
                double yy = (0) / rangeY * height + dy;

                da.DrawArc(gc, false, (int)xx, (int)yy, (int)(width), (int)(height), 0, 360 * 64);



                gc.RgbFgColor = new Gdk.Color(255, 0, 255);
                for (int i = 0; i < ROIs.Count; i++)
                {
                    double x = (ROIdrawPos[i, 0] - minX) / rangeX * width + sz / 2;
                    double y = height - ((ROIdrawPos[i, 1] - minY) / rangeY * height) + dy;
                    da.DrawArc(gc, true, (int)x, (int)y, sz, sz, 0, 360 * 64);
                }

                gc.RgbFgColor = new Gdk.Color(0, 0, 0);
                for (int i = 0; i < ROIs.Count; i++)
                {
                    double    x   = (ROIdrawPos[i, 0] - minX) / rangeX * width + sz;
                    double    y   = height - ((ROIdrawPos[i, 1] - minY) / rangeY * height) + dy;
                    Gtk.Label lab = new Gtk.Label();
                    lab.Text = ROIs[i].name;
                    da.DrawLayout(gc, (int)(x), (int)y, lab.Layout);
                }

                Gtk.Label lab2 = new Gtk.Label();
                lab2.Text = "R";
                da.DrawLayout(gc, (int)(width - 5), (int)(height - 5), lab2.Layout);
            }
Пример #5
0
            public void draw2D(Gdk.Drawable da)
            {
                if (SrcPos == null)
                {
                    return;
                }
                try
                {
                    int width, height;
                    da.GetSize(out width, out height);

                    double dx, dy;
                    dx     = 20;
                    dy     = 20;
                    width  = width - 2 * (int)dy;
                    height = height - 2 * (int)dx;

                    double maxX, minX, maxY, minY;
                    maxX = -999; maxY = -999;
                    minX = 999; minY = 999;
                    for (int i = 0; i < this.numDet; i++)
                    {
                        if (maxX < this.DetPos[i, 0])
                        {
                            maxX = this.DetPos[i, 0];
                        }
                        if (maxY < this.DetPos[i, 1])
                        {
                            maxY = this.DetPos[i, 1];
                        }
                        if (minX > this.DetPos[i, 0])
                        {
                            minX = this.DetPos[i, 0];
                        }
                        if (minY > this.DetPos[i, 1])
                        {
                            minY = this.DetPos[i, 1];
                        }
                    }


                    for (int i = 0; i < this.numSrc; i++)
                    {
                        if (maxX < this.SrcPos[i, 0])
                        {
                            maxX = this.SrcPos[i, 0];
                        }
                        if (maxY < this.SrcPos[i, 1])
                        {
                            maxY = this.SrcPos[i, 1];
                        }
                        if (minX > this.SrcPos[i, 0])
                        {
                            minX = this.SrcPos[i, 0];
                        }
                        if (minY > this.SrcPos[i, 1])
                        {
                            minY = this.SrcPos[i, 1];
                        }
                    }


                    ROIdrawPos = new double[ROIs.Count, 2];
                    for (int i = 0; i < ROIs.Count; i++)
                    {
                        ROIdrawPos[i, 0] = minX - .15 * (maxX - minX);
                        ROIdrawPos[i, 1] = minY - .25 * (i + 1) * (maxY - minY);
                    }
                    if (ROIs.Count > 0)
                    {
                        minY = minY - (ROIs.Count + 1) * .25 * (maxY - minY);
                        minX = minX - .15 * (maxX - minX);
                    }

                    double rangeX = maxX - minX;
                    double rangeY = maxY - minY;

                    Gdk.GC gc = new Gdk.GC(da);

                    gc.RgbBgColor = new Gdk.Color(0, 0, 0);
                    gc.RgbFgColor = new Gdk.Color(0, 0, 0);
                    Rectangle rarea = new Rectangle();
                    rarea.Height = height + 2 * (int)dy;
                    rarea.Width  = width + 2 * (int)dx;
                    da.DrawRectangle(gc, true, rarea);

                    gc.RgbBgColor = new Gdk.Color(0, 0, 0);
                    gc.RgbFgColor = new Gdk.Color(255, 255, 255);
                    rarea         = new Rectangle();
                    rarea.Height  = height - 2 + 2 * (int)dx;;
                    rarea.Width   = width - 2 + 2 * (int)dx;;
                    rarea.X       = 1;
                    rarea.Y       = 1;

                    da.DrawRectangle(gc, true, rarea);

                    int sz = 10;

                    if (this.measlistAct == null)
                    {
                        this.measlistAct = new bool[this.ChannelMap.Length];
                        for (int i = 0; i < this.ChannelMap.Length; i++)
                        {
                            this.measlistAct[i] = false;
                        }
                        this.measlistAct[0] = true;
                    }


                    gc.RgbFgColor = new Gdk.Color(0, 0, 0);
                    gc.SetLineAttributes(3, LineStyle.Solid, CapStyle.Projecting, JoinStyle.Round);
                    for (int i = 0; i < this.numChannels; i++)
                    {
                        if (this.ChannelMap[i].datasubtype.Equals(this.ChannelMap[0].datasubtype))
                        {
                            if (this.measlistAct[i])
                            {
                                gc.RgbFgColor = colormap[i]; //new Gdk.Color (0, 0, 0);
                            }
                            else
                            {
                                gc.RgbFgColor = new Gdk.Color(230, 230, 230);
                            }
                            int si = this.ChannelMap[i].sourceindex;
                            int di = this.ChannelMap[i].detectorindex;

                            double x1 = (this.DetPos[di, 0] - minX) / rangeX * width;
                            double y1 = height - ((this.DetPos[di, 1] - minY) / rangeY * height) + dy;
                            double x2 = (this.SrcPos[si, 0] - minX) / rangeX * width;
                            double y2 = height - ((this.SrcPos[si, 1] - minY) / rangeY * height) + dy;
                            da.DrawLine(gc, (int)x1, (int)y1, (int)x2, (int)y2);
                            //pts[cnt]=new Gdk.Point((int)x,(int)y);
                        }
                    }


                    gc.RgbFgColor = new Gdk.Color(0, 255, 0);
                    gc.SetLineAttributes(3, LineStyle.Solid, CapStyle.Round, JoinStyle.Round);
                    //  Gdk.Point[] pts = new Gdk.Point[this.numdet+this.numsrc];
                    for (int i = 0; i < this.numDet; i++)
                    {
                        double x = (this.DetPos[i, 0] - minX) / rangeX * width - sz / 2;
                        double y = height - ((this.DetPos[i, 1] - minY) / rangeY * height) - sz / 2 + dy;
                        da.DrawArc(gc, true, (int)x, (int)y, sz, sz, 0, 360 * 64);
                        //pts[cnt]=new Gdk.Point((int)x,(int)y);
                    }
                    gc.RgbFgColor = new Gdk.Color(0, 0, 0);
                    for (int i = 0; i < this.numDet; i++)
                    {
                        double x = (this.DetPos[i, 0] - minX) / rangeX * width - sz / 2;
                        double y = height - ((this.DetPos[i, 1] - minY) / rangeY * height) - sz / 2 + dy;

                        Gtk.Label lab = new Gtk.Label();
                        lab.Text = string.Format("D{0}", i + 1);
                        da.DrawLayout(gc, (int)x, (int)y, lab.Layout);
                    }


                    gc.RgbBgColor = new Gdk.Color(0, 255, 0);
                    gc.RgbFgColor = new Gdk.Color(255, 0, 0);
                    gc.SetLineAttributes(3, LineStyle.Solid, CapStyle.Round, JoinStyle.Round);
                    for (int i = 0; i < this.numSrc; i++)
                    {
                        double x = (this.SrcPos[i, 0] - minX) / rangeX * width - sz / 2;
                        double y = height - ((this.SrcPos[i, 1] - minY) / rangeY * height) - sz / 2 + dy;
                        da.DrawArc(gc, true, (int)x, (int)y, sz, sz, 0, 360 * 64);
                    }

                    gc.RgbFgColor = new Gdk.Color(0, 0, 0);
                    for (int i = 0; i < this.numSrc; i++)
                    {
                        double x = (this.SrcPos[i, 0] - minX) / rangeX * width - sz / 2;
                        double y = height - ((this.SrcPos[i, 1] - minY) / rangeY * height) - sz / 2 + dy;

                        Gtk.Label lab = new Gtk.Label();
                        lab.Text = string.Format("S{0}", i + 1);
                        da.DrawLayout(gc, (int)x, (int)y, lab.Layout);
                    }

                    gc.RgbFgColor = new Gdk.Color(255, 0, 255);
                    for (int i = 0; i < ROIs.Count; i++)
                    {
                        double x = (ROIdrawPos[i, 0] - minX) / rangeX * width + sz / 2;
                        double y = height - ((ROIdrawPos[i, 1] - minY) / rangeY * height) + dy;
                        da.DrawArc(gc, true, (int)x, (int)y, sz, sz, 0, 360 * 64);
                    }

                    gc.RgbFgColor = new Gdk.Color(0, 0, 0);
                    for (int i = 0; i < ROIs.Count; i++)
                    {
                        double    x   = (ROIdrawPos[i, 0] - minX) / rangeX * width + sz;
                        double    y   = height - ((ROIdrawPos[i, 1] - minY) / rangeY * height) + dy;
                        Gtk.Label lab = new Gtk.Label();
                        lab.Text = ROIs[i].name;
                        da.DrawLayout(gc, (int)(x), (int)y, lab.Layout);
                    }

                    Gtk.Label lab2 = new Gtk.Label();
                    lab2.Text = "L";
                    da.DrawLayout(gc, (int)(width - 5), (int)(height - 5), lab2.Layout);
                }
                catch { }

                return;
            }