Revised version of my crosshair script, now works even when
powerpro is set to allow off-screen bars.
Requires powerpro beta 4.5.14.


; ----- Locked bar version -----
; Attach following script to hot key
; activate key once to show cross hair
; again to remove.
; click and drag anchor to move cross hair.
; middle click anchor to remove cross hair.
; right click anchor to follow mouse,
; activate key to remove.
; non-zero arg(1) enables follow mouse.
; supports pproconf>lists>setup>all-bars>allow-off-screen on

static bShowing,xpos,ypos,ev, xcrosshair, ycrosshair, xanchor
static transparency=128
static thickness=1
local anchorcolor="128 128 128"
local crosshaircolor="255 0 0"
if (!bShowing) do

//not showing, draw initial cross hair
bShowing=1
xpos=xmouse
ypos=ymouse

xcrosshair = cl.create("xcrosshair",1)
xcrosshair.newproperties("topmost flatflat back: "++crosshaircolor)
xcrosshair.addproperties(" left: 0 right: "++2*xscreen)
xcrosshair.addproperties(" top: "++ypos-thickness)
xcrosshair.addproperties(" bottom: "++ypos+thickness)
xcrosshair.addproperties(" mousethrough transparent: "++transparency)
xcrosshair.lockto(1,"xanchor",50,0,50,0-thickness,50,0,50)

ycrosshair = cl.create("ycrosshair", 1)
ycrosshair.newproperties("topmost flatflat back: "++crosshaircolor)
ycrosshair.addproperties("top: 0 bottom: "++2*yscreen)
ycrosshair.addproperties("left: "++xpos-thickness)
ycrosshair.addproperties("right: "++xpos+thickness)
ycrosshair.addproperties(" mousethrough transparent: "++transparency)
ycrosshair.lockto(1,"xanchor",50,0-thickness,50,0,50,0,50)

xanchor = cl.create("xanchor",1)
xanchor.newproperties("topmost flatflat back: "++anchorcolor)
xanchor.addproperties(" left: "++xpos-max(4,thickness))
xanchor.addproperties(" right: "++xpos+max(4,thickness))
xanchor.addproperties(" top: "++ypos-max(4,thickness))
xanchor.addproperties(" bottom: "++ypos+max(4,thickness))
xanchor.addproperties(" transparent: "++transparency)
xanchor.insert(0)
xanchor.addleft(0,"format","drag")
xanchor.addmiddle(0,cb("@cancel"))
xanchor.addright(0,cb("@timer",0))
xanchor.addproperties(" tooltips")
xanchor.settooltip(0,"*info (expr("++;;+
?'word(win.getrect("ycrosshair"),1)+'++thickness++?'++","++'++;;+
?'word(win.getrect("xcrosshair"),2)+'++thickness++?'))/'++;;+
?'"L»drag M»close R»follow mouse"')

if(arg(1))
[EMAIL PROTECTED](0) //non-zero arg(1) enables follow mouse

bar.show("xanchor")
bar.show("xcrosshair")
bar.show("ycrosshair")

else //if called when showing,cancels
[EMAIL PROTECTED]
endif
quit

@cancel
if (event.exists(ev))
ev=event.destroy(ev)
bar.close("xcrosshair")
bar.close("ycrosshair")
bar.close("xanchor")
bShowing=0
quit

@timer
xanchor.addproperties(" mousethrough")
xanchor.refresh //unlike xanchor.redisplay
ev = event.createms(100,arg(1),cb("@update"))
quit

// call here to query mouse pos and update
@update
static xpos, ypos,bShowing
if (!bShowing) // should never happen
quit

local xnow=xmouse
local ynow=ymouse
if (xnow != xpos || ynow != ypos) do
xpos=xnow
ypos=ynow
win.move("xanchor", xnow, ynow)
endif
quit



Attention: PowerPro's Web site has moved: http://www.ppro.org 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/power-pro/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/power-pro/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to