TOP
|
[ 录入者:admin | 时间:2007-10-27 17:18:46
| 作者: | 来源:
| 浏览:689次 ] |
脚本需要安装REBOL/View 两个脚本文件http://www.autohotkey.net/~faerl/drag.r http://www.autohotkey.net/~faerl/line.r
http://www.autohotkey.net/~faerl/drag.r rebol[title: drag.r] CiscoRouter: [] router: make face [ node: [] text: "Drag This Face" offset: 0x0 size: 50x50 color: gold edge: none feel: make feel [ engage: func [face action event] [ if action = 'down [face/data: event/offset] if find [over away] action [ face/offset: face/offset + event/offset - face/data ;face/text: form face/offset AllRouter/effect: [draw [pen blue line-width 3 line 10 20x50]] show face ] ] ] ] AllRouter: layout/size [ button "Router" [ append CiscoRouter make router [node: [1 2] text: length? AllRouter/pane] append AllRouter/pane last CiscoRouter print length? AllRouter/pane show AllRouter ] ] 400x400 view AllRouter
http://www.autohotkey.net/~faerl/line.r rebol[title: line.r] draw-beziere-curve: has [result pp x0 x1 x2 x3 y0 y1 y2 y3] [ result: make block! 120 pp: p0/size/x / 2 x0: p0/offset/x + pp y0: p0/offset/y + pp x1: p1/offset/x + pp y1: p1/offset/y + pp x2: p2/offset/x + pp y2: p2/offset/y + pp x3: p3/offset/x + pp y3: p3/offset/y + pp insert result compose [ pen 0.0.255 line (p0/offset + pp) (p1/offset + pp) line (p2/offset + pp) (p3/offset + pp) pen 255.255.255 line (p0/offset + pp) ] return result ] click?: false mouse-pos: 0x0 block: layout [ origin 0 bkg: box black 400x400 with [effect: reduce ['draw make block! 120]] style point box 10 with [ effect: [draw [pen 0.255.0 fill-pen 0.200.0 circle 4x4 4]] changes: [offset] feel: make feel [ engage: func [f a e][ if a = 'down [click?: on mouse-pos: e/offset] if a = 'up [click?: off] if find [over away] a [ if click? [ f/offset: f/offset + e/offset - mouse-pos bkg/effect/2: draw-beziere-curve show [bkg f] ] ] ] ] ] at 3000 p0: point at 200x300 p1: point at 200x300 p2: point at 1000 p3: point do [bkg/effect/2: draw-beziere-curve] at 100x0 button "Add Router" [ append block/pane make-face 'button show block ] ] view block
这两个是rebol脚本,想把它做成boson拓扑图软件,但是没有太多时间写程序。以完成添加Router和连线的基础,把它贴出来,希望大家可以完成它。
rebol语言网站www.rebol.com文档http://www.rebol.com/docs.html
|
|
|
|