View Raw SPL
lineedit(s)
{
        local i, h, y, inplace = 0;
        local xl, xr, yt, yb, ytic, yticset;

        if (argc < 1)
        {
                inplace = 1;
                s       = refwindow(w0);
        }

        if (length(s) > 0)
        {
                /* get line handles placed for editing */
                h = findhandle(s, "tag", "editline");

                if (length(h) > 0)
                {
                        echo("Editing Points ...");

                        if (inplace)
                        {
                                /* original coords */
                                xl = getxl(s);
                                xr = getxr(s);
                                yt = getyt(s);
                                yb = getyb(s);

                                ytic    = getytic(s);
                                yticset = getyticset(s);

                        }

                        /* series to edit */
                        y = refseries(s);

                        /* edit data for each line */
                        loop (i = 1..length(h))
                        {
                                y = editline(h[i], y);
                        }

                        deletehandle(h);

                        echo("");

                        if (inplace)
                        {
                                plotmode(w0, 0);
                                
                                /* see if we have overlays */
                                if (getfocus(-1) > 1)
                                {
                                        w0[.., getfocus()] = y;
                                }
                                else
                                {
                                        w0 = y;
                                        sety(yb, yt);

                                        if (yticset)
                                        {
                                                setytic(ytic);
                                        }
                                        else
                                        {
                                                setytic(-1);
                                        }
                                }
                                
                                setx(xl, xr);
                                plotmode(w0, 1);
                        }
                        else
                        {
                                return(y);
                        }
                }
        }
}