move segment of a wave/graph

Hi How can I move a segment of a wave in a graph by a fixed ditance ( kind of "block move" or "segment move" along y direction )
I tried the segment mover (cntl + edit wave ) in Poly tool but it does only for adjacent points.
Is there any way for example by placing two cursors on the graph at points say at (x1,y1) and (x2,y2) and then shifting (visually/by dragging the curve portion) all the points within (x1,y1) and (x2,y2) to new location (x1,y1-5) ...(x2,y2-5) where all the points within (x1, y1) and (x1,y2) also moves by the same amount ( -5) .
The arithmatic panel can do the shift but for it works on whole graph, is there any way to do it on section of a graph.
There is no way that I know of to do this with the mouse.

Here is a function that does it programmatically:

Function AddToXYPairSegment1(xWave, yWave, startX, endX, offset)
    Wave xWave, yWave
    Variable startX, endX
    Variable offset
   
    Variable numPoints = numpnts(xWave)
    Variable i
    for(i=0; i<numPoints; i+=1)
        Variable xval = xWave[i]
        if (xVal>=startX && xVal<=endX)
            yWave[i] += offset
        endif
    endfor 
End


Here is another function that does the same thing but much faster:

Function AddToXYPairSegment2(xWave, yWave, startX, endX, offset)
    Wave xWave, yWave
    Variable startX, endX
    Variable offset
   
    yWave = (xWave>=startX && xWave<=endX) ? yWave+offset : yWave
End


Execute this for help on ?:
DisplayHelpTopic "? :"

Thanks a lot for your reply.
I tried to get xwave and ywave from cursor but it didnt work. Somehow I didnt able to define the function properly.
Can you put some light !!

#pragma rtGlobals=1     // Use modern global access method.

Menu "Segment Move"
"Move Segment ...", AddToXYPairSegment2("", "", "", "",10)
End


Function AddToXYPairSegment2(XWave, YWave, startX, endX, offset)

Variable offset

WAVE/Z w = CsrWaveRef(A)
if (!WaveExists(w)) // Cursor is not on any wave.
return NaN
endif

Variable  startX = xcsr(A)
Variable endX = xcsr(B)

Wave YWave = w
Wave XWave = CsrXWave(A)

    YWave = (XWave>=startX && XWave<=endX) ? YWave+offset : YWave
    DisplayYWave vs XWaveA 
   
End
Try this:

   
Function AddToXYPairSegment3(offset)
    Variable offset

    WAVE/Z yWave = CsrWaveRef(A)
    if (!WaveExists(yWave))         // Cursor is not on any wave
        return -1
    endif
     
    WAVE/Z xWave = CsrXWaveRef(A)
    if (!WaveExists(xWave))         // Cursor is not on XY pair
        return -1
    endif
     
    Variable startX = hcsr(A)
    Variable endX = hcsr(B)
   
    if (startX > endX)
        return -1
    endif
 
    YWave = (XWave>=startX && XWave<=endX) ? YWave+offset : YWave
   
    return 0
End