+static void drawlink(gfxdevice_t*dev, ActionTAG*actions1, ActionTAG*actions2, gfxline_t*points, char mouseover)
+{
+ swfoutput_internal*i = (swfoutput_internal*)dev->internal;
+ RGBA rgb;
+ SRECT r;
+ int lsid=0;
+ int fsid;
+ struct plotxy p1,p2,p3,p4;
+ int myshapeid;
+ int myshapeid2;
+ double posx = 0;
+ double posy = 0;
+ int t;
+ int buttonid = getNewID(dev);
+ gfxbbox_t bbox = gfxline_getbbox(points);
+
+ /* shape */
+ myshapeid = getNewID(dev);
+ i->tag = swf_InsertTag(i->tag,ST_DEFINESHAPE3);
+ swf_ShapeNew(&i->shape);
+ rgb.r = rgb.b = rgb.a = rgb.g = 0;
+ fsid = swf_ShapeAddSolidFillStyle(i->shape,&rgb);
+ swf_SetU16(i->tag, myshapeid);
+ r.xmin = (int)(bbox.xmin*20);
+ r.ymin = (int)(bbox.ymin*20);
+ r.xmax = (int)(bbox.xmax*20);
+ r.ymax = (int)(bbox.ymax*20);
+ swf_SetRect(i->tag,&r);
+ swf_SetShapeStyles(i->tag,i->shape);
+ swf_ShapeCountBits(i->shape,NULL,NULL);
+ swf_SetShapeBits(i->tag,i->shape);
+ swf_ShapeSetAll(i->tag,i->shape,/*x*/0,/*y*/0,0,fsid,0);
+ i->swflastx = i->swflasty = 0;
+ drawgfxline(dev, points);
+ swf_ShapeSetEnd(i->tag);
+
+ /* shape2 */
+ myshapeid2 = getNewID(dev);
+ i->tag = swf_InsertTag(i->tag,ST_DEFINESHAPE3);
+ swf_ShapeNew(&i->shape);
+ rgb.r = rgb.b = rgb.a = rgb.g = 255;
+ rgb.a = 40;
+ fsid = swf_ShapeAddSolidFillStyle(i->shape,&rgb);
+ swf_SetU16(i->tag, myshapeid2);
+ r.xmin = (int)(bbox.xmin*20);
+ r.ymin = (int)(bbox.ymin*20);
+ r.xmax = (int)(bbox.xmax*20);
+ r.ymax = (int)(bbox.ymax*20);
+ swf_SetRect(i->tag,&r);
+ swf_SetShapeStyles(i->tag,i->shape);
+ swf_ShapeCountBits(i->shape,NULL,NULL);
+ swf_SetShapeBits(i->tag,i->shape);
+ swf_ShapeSetAll(i->tag,i->shape,/*x*/0,/*y*/0,0,fsid,0);
+ i->swflastx = i->swflasty = 0;
+ drawgfxline(dev, points);
+ swf_ShapeSetEnd(i->tag);
+
+ if(!mouseover)
+ {
+ i->tag = swf_InsertTag(i->tag,ST_DEFINEBUTTON);
+ swf_SetU16(i->tag,buttonid); //id
+ swf_ButtonSetFlags(i->tag, 0); //menu=no
+ swf_ButtonSetRecord(i->tag,0x01,myshapeid,i->depth,0,0);
+ swf_ButtonSetRecord(i->tag,0x02,myshapeid2,i->depth,0,0);
+ swf_ButtonSetRecord(i->tag,0x04,myshapeid2,i->depth,0,0);
+ swf_ButtonSetRecord(i->tag,0x08,myshapeid,i->depth,0,0);
+ swf_SetU8(i->tag,0);
+ swf_ActionSet(i->tag,actions1);
+ swf_SetU8(i->tag,0);
+ }
+ else
+ {
+ i->tag = swf_InsertTag(i->tag,ST_DEFINEBUTTON2);
+ swf_SetU16(i->tag,buttonid); //id
+ swf_ButtonSetFlags(i->tag, 0); //menu=no
+ swf_ButtonSetRecord(i->tag,0x01,myshapeid,i->depth,0,0);
+ swf_ButtonSetRecord(i->tag,0x02,myshapeid2,i->depth,0,0);
+ swf_ButtonSetRecord(i->tag,0x04,myshapeid2,i->depth,0,0);
+ swf_ButtonSetRecord(i->tag,0x08,myshapeid,i->depth,0,0);
+ swf_SetU8(i->tag,0); // end of button records
+ swf_ButtonSetCondition(i->tag, BC_IDLE_OVERUP);
+ swf_ActionSet(i->tag,actions1);
+ if(actions2) {
+ swf_ButtonSetCondition(i->tag, BC_OVERUP_IDLE);
+ swf_ActionSet(i->tag,actions2);
+ swf_SetU8(i->tag,0);
+ swf_ButtonPostProcess(i->tag, 2);
+ } else {
+ swf_SetU8(i->tag,0);
+ swf_ButtonPostProcess(i->tag, 1);
+ }
+ }
+
+ i->tag = swf_InsertTag(i->tag,ST_PLACEOBJECT2);
+
+ if(posx!=0 || posy!=0) {
+ SPOINT p;
+ p.x = (int)(posx*20);
+ p.y = (int)(posy*20);
+ p = swf_TurnPoint(p, &i->page_matrix);
+ MATRIX m;
+ m = i->page_matrix;
+ m.tx = p.x;
+ m.ty = p.y;
+ swf_ObjectPlace(i->tag, buttonid, getNewDepth(dev),&m,0,0);
+ } else {
+ swf_ObjectPlace(i->tag, buttonid, getNewDepth(dev),&i->page_matrix,0,0);
+ }