X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=swfs%2Frfxview.sc;h=9707a77ade28f944f5eb0303592132f5cb475f87;hb=47dfa706dc7d700ab587db9f8ac54999c5ffa506;hp=e87010d9125b8effe14f05b98b91f5f7b97257b1;hpb=d3a12623c97905f4b0cd69fd93b33e50c72f5bef;p=swftools.git diff --git a/swfs/rfxview.sc b/swfs/rfxview.sc index e87010d..9707a77 100644 --- a/swfs/rfxview.sc +++ b/swfs/rfxview.sc @@ -101,6 +101,13 @@ lineTo 2,-8 .end +.outline zoomoutline: + moveTo 8,0 lineTo 4,3 lineTo 4,-3 lineTo 8,0 + moveTo -8,0 lineTo -4,3 lineTo -4,-3 lineTo -8,0 + moveTo 0,8 lineTo 3,4 lineTo -3,4 lineTo 0,8 + moveTo 0,-8 lineTo 3,-4 lineTo -3,-4 lineTo 0,-8 +.end + .outline minusoutline: moveTo -7,2 lineTo -7,-2 @@ -124,6 +131,8 @@ .filled mincircle_over outline=minusoutline fill=grad4l line=1 color=#00000060 .filled oincircle outline=oneoneoutline fill=grad2l line=1.2 color=#00000060 .filled oincircle_over outline=oneoneoutline fill=grad4l line=1.2 color=#00000060 +.filled zincircle outline=zoomoutline fill=grad2l line=1 color=#00000060 +.filled zincircle_over outline=zoomoutline fill=grad4l line=1 color=#00000060 .sprite plusface .put shadcircle 11 13 pin=center .put outcircle 11 11 pin=center .put pincircle 11 11 pin=center scale=90% @@ -175,6 +184,16 @@ .put shadcircle 11 13 pin=center scale=90% .put outcircle_over 11 11 pin=center scale=90% .put oincircle_over 9 11 pin=center scale=79% .end +.sprite zbface + .put shadcircle 11 13 pin=center .put outcircle 11 11 pin=center .put zincircle 10 11 pin=center scale=90% luminance=50% +.end +.sprite zbfaceover + .put shadcircle 11 13 pin=center .put outcircle_over 11 11 pin=center .put zincircle_over 10 11 pin=center scale=90% +.end +.sprite zbfacedown + .put shadcircle 11 13 pin=center scale=90% .put outcircle_over 11 11 pin=center scale=90% .put zincircle_over 10 11 pin=center scale=79% +.end + .button rightbutton .show rbface as=idle .show outcircle as=area @@ -210,17 +229,25 @@ .show obfaceover as=hover .end +.button fullsizebutton + .show zbface as=idle + .show outcircle as=area + .show zbfacedown as=pressed + .show zbfaceover as=hover +.end + #======================================== frame =========================================================== .frame 1 .put p1=plusbutton x=width-25-20 y=20 pin=center .put m1=minusbutton x=width-50-20 y=20 pin=center +.put o1=oneonebutton x=width-75-20 y=20 pin=center +.put z1=fullsizebutton x=width-100-20 y=20 pin=center + .put l1=leftbutton x=width/2-100 y=20 pin=center .put r1=rightbutton x=width/2+100 y=20 pin=center -.put o1=oneonebutton x=width-75-20 y=20 pin=center - .sprite background .end .put background @@ -298,16 +325,20 @@ .put hscrollbar y=height-22 x=10 .put vscrollbar x=width-22 y=40 -.edittext et width=110 height=20 font=arial size=18pt color=black noselect align=center +.edittext et width=50 height=20 font=arial size=18pt color=black variable=current_pagenumber maxlength=3 text="1" align=left +.edittext etmiddle text="/" width=10 height=25 font=arial color=black noselect size=18pt align=center +.edittext et_total_pages width=50 height=25 font=arial color=black noselect size=18pt align=right -.font dbgarial filename="../wx/Courier.ttf" +#.font dbgarial filename="Courier.ttf" #.edittext debugtxt width=width height=20 font=dbgarial size=18pt color=#004000 noselect #.put debugtxt y=20 -.put et x=width/2-30 y=8 +.put et x=width/2-55 y=8 +.put etmiddle x=width/2-5 y=8 +.put et_total_pages x=width/2+5 y=8 -#.swf swf filename=paper5.swf -.sprite swf +#.swf viewport filename=paper5.viewport +.sprite viewport .end .box f width=100 height=100 line=0 fill=black @@ -315,11 +346,11 @@ .button areabutton .show f as=area .on_press inside: - swf.startDrag(false, left-scrollxrange, top-scrollyrange, left,top); + viewport.startDrag(false, left-scrollxrange, top-scrollyrange, left,top); Dragging = "xy"; .end .on_release: - swf.stopDrag(); + viewport.stopDrag(); Dragging = ""; .end .end @@ -329,12 +360,13 @@ .put f .end .put cliparea=cf x=10 y=40 -.put swf x=10 y=40 +.put viewport x=10 y=40 -.action: - swfwidth = swf._width; - swfheight = swf._height; +.action: + et_total_pages.text=viewport._totalframes; + swfwidth = viewport._width; + swfheight = viewport._height; Dragging = ""; @@ -353,12 +385,15 @@ hscrollbar._y = fullheight-22; p1._x = fullwidth-25-20 - p1._width/2; o1._x = fullwidth-50-20 - o1._width/2; - m1._x = fullwidth-75-20 - m1._width/2; + z1._x = fullwidth-75-20 - z1._width/2; + m1._x = fullwidth-100-20 - m1._width/2; l1._x = fullwidth/2-100 - l1._width/2; r1._x = fullwidth/2+100 - r1._width/2; - et._x = fullwidth/2 - et._width/2; + et._x = fullwidth/2 - (et._width+etmiddle._width+et_total_pages._width)/2; + etmiddle._x = fullwidth/2 - (et._width+etmiddle._width+et_total_pages._width)/2 + et._width; + et_total_pages._x = fullwidth/2 - (et._width+etmiddle._width+et_total_pages._width)/2 + et._width+etmiddle._width; //.box f width=width-40 height=height-40-30 line=0 fill=black //.box vscroll1 width=10 height=height-40-30 line=1 color=#00000060 fill=grad7 @@ -395,7 +430,7 @@ areabutton._yscale = contentheight; cliparea._xscale = contentwidth; cliparea._yscale = contentheight; - swf.setMask(cliparea); + viewport.setMask(cliparea); lastzoom = 1; @@ -403,10 +438,11 @@ zoom = 1; //debugtxt.text = Stage.width+ " x " + Stage.height; + //debugtxt.text = zoomtype; setPageNr = function() { - et.text = " "+pagenr+" / "+swf._totalframes; - swf.gotoAndStop(pagenr); + current_pagenumber = pagenr; + viewport.gotoAndStop(pagenr); }; setNoScrollZoomLevel = function() { @@ -422,6 +458,18 @@ } }; + setOneDirScrollZoomLevel = function() { + xscale = contentwidth / swfwidth; + yscale = contentheight / swfheight; + if(xscale > yscale) { + zoom = xscale; + setZoomLevel(); + } else { + zoom = yscale; + setZoomLevel(); + } + }; + set11ZoomLevel = function() { zoom = 1.0; setZoomLevel(); @@ -429,12 +477,12 @@ swfpos2scrollbars = function() { if(scrollxrange) { - hscrollbar._x = 10 + (left-swf._x)*scrollbarxrange/scrollxrange; + hscrollbar._x = 10 + (left-viewport._x)*scrollbarxrange/scrollxrange; } else { hscrollbar._x = 10; } if(scrollyrange) { - vscrollbar._y = 40 + (top-swf._y)*scrollbaryrange/scrollyrange; + vscrollbar._y = 40 + (top-viewport._y)*scrollbaryrange/scrollyrange; } else { vscrollbar._y = 40; } @@ -469,24 +517,24 @@ scrollbaryrange = 0; } - swf._xscale = zoom*100; - swf._yscale = zoom*100; + viewport._xscale = zoom*100; + viewport._yscale = zoom*100; - focusx = contentwidth/2 - (swf._x-10); - focusy = contentheight/2 - (swf._y-40); + focusx = contentwidth/2 - (viewport._x-10); + focusy = contentheight/2 - (viewport._y-40); - swf._x = left - focusx * zoom / lastzoom + width/2; - swf._y = top - focusy * zoom / lastzoom + height/2; + viewport._x = left - focusx * zoom / lastzoom + width/2; + viewport._y = top - focusy * zoom / lastzoom + height/2; - if(swf._x > left) { - swf._x = left; - } else if(swf._x < left-scrollxrange) { - swf._x = left-scrollxrange; + if(viewport._x > left) { + viewport._x = left; + } else if(viewport._x < left-scrollxrange) { + viewport._x = left-scrollxrange; } - if(swf._y > top) { - swf._y = top; - } else if(swf._y < top-scrollyrange) { - swf._y = top-scrollyrange; + if(viewport._y > top) { + viewport._y = top; + } else if(viewport._y < top-scrollyrange) { + viewport._y = top-scrollyrange; } swfpos2scrollbars(); @@ -520,9 +568,23 @@ pagenr = 1; setPageNr(); - setNoScrollZoomLevel(); - //set11ZoomLevel(); + + if(zoomtype=="1") { + set11ZoomLevel(); + } else if(zoomtype=="2") { + setNoScrollZoomLevel(); + } else { + setOneDirScrollZoomLevel(); + } + et.onChanged = function(){ + if(current_pagenumber <= viewport._totalframes) { + if (current_pagenumber > 0) { + pagenr = int(current_pagenumber); + setPageNr(); + } + } + }; l1.onRelease = function(){ if(pagenr > 1) { pagenr = pagenr - 1; @@ -530,7 +592,7 @@ } }; r1.onRelease = function(){ - if(pagenr < swf._totalframes) { + if(pagenr < viewport._totalframes) { pagenr = pagenr + 1; setPageNr(); } @@ -552,11 +614,14 @@ o1.onRelease = function(){ setNoScrollZoomLevel(); }; + z1.onRelease = function(){ + setOneDirScrollZoomLevel(); + }; refreshDrag = function(){ if(Dragging == "h") { - swf._x = left + (10-hscrollbar._x)*scrollxrange/scrollbarxrange; + viewport._x = left + (10-hscrollbar._x)*scrollxrange/scrollbarxrange; } else if(Dragging == "v") { - swf._y = top + (40-vscrollbar._y)*scrollyrange/scrollbaryrange; + viewport._y = top + (40-vscrollbar._y)*scrollyrange/scrollbaryrange; } else if(Dragging == "xy") { swfpos2scrollbars(); }