1 # rfxview.sc - a document viewer for pdf2swf converted files
3 # Copyright (c) 2008 Matthias Kramm
5 # Permission is hereby granted, free of charge, to any person obtaining a copy
6 # of this software and associated documentation files (the "Software"), to deal
7 # in the Software without restriction, including without limitation the rights
8 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 # copies of the Software, and to permit persons to whom the Software is
10 # furnished to do so, subject to the following condition:
12 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 .flash filename=rfxview.swf fps=30 bbox=600x800 version=8 compress background=#CCCCCC export=0
26 #======================================== buttons ===========================================================
28 .gradient grad1 radial x=4 y=4 r=28:
33 .gradient grad2 linear width=8 height=6 rotate=120:
38 .gradient grad4 linear width=8 height=6 rotate=120:
44 .gradient grad2l linear width=8 height=6 rotate=120:
48 .gradient grad4l linear width=8 height=6 rotate=120:
53 .gradient grad3 radial x=4 y=4 r=28:
59 .gradient grad7 linear rotate=180:
64 .gradient grad72 linear rotate=45:
69 .outline arrowoutline:
76 .outline larrowoutline:
83 .font arialbold filename="../wx/ArialBold.ttf" glyphs="1:"
84 .font arial filename="../wx/Arial.ttf" glyphs="0123456789 /:"
86 .textshape oneoneoutline text="1:1" font=arialbold size=14pt
104 .outline zoomoutline:
105 moveTo 8,0 lineTo 4,3 lineTo 4,-3 lineTo 8,0
106 moveTo -8,0 lineTo -4,3 lineTo -4,-3 lineTo -8,0
107 moveTo 0,8 lineTo 3,4 lineTo -3,4 lineTo 0,8
108 moveTo 0,-8 lineTo 3,-4 lineTo -3,-4 lineTo 0,-8
111 .outline minusoutline:
119 .circle shadcircle line=0 fill=#00000033 r=11.5
121 .circle outcircle line=2 color=#00000060 fill=grad1 r=11
122 .circle outcircle_over line=2 color=#00000060 fill=grad3 r=11
124 .filled incircle outline=arrowoutline fill=grad2 line=1 color=#00000060
125 .filled incircle_over outline=arrowoutline fill=grad4 line=1 color=#00000060
126 .filled lincircle outline=larrowoutline fill=grad2l line=1 color=#00000060
127 .filled lincircle_over outline=larrowoutline fill=grad4l line=1 color=#00000060
128 .filled pincircle outline=plusoutline fill=grad2l line=1 color=#00000060
129 .filled pincircle_over outline=plusoutline fill=grad4l line=1 color=#00000060
130 .filled mincircle outline=minusoutline fill=grad2l line=1 color=#00000060
131 .filled mincircle_over outline=minusoutline fill=grad4l line=1 color=#00000060
132 .filled oincircle outline=oneoneoutline fill=grad2l line=1.2 color=#00000060
133 .filled oincircle_over outline=oneoneoutline fill=grad4l line=1.2 color=#00000060
134 .filled zincircle outline=zoomoutline fill=grad2l line=1 color=#00000060
135 .filled zincircle_over outline=zoomoutline fill=grad4l line=1 color=#00000060
138 .put shadcircle 11 13 pin=center .put outcircle 11 11 pin=center .put pincircle 11 11 pin=center scale=90%
141 .put shadcircle 11 13 pin=center .put outcircle_over 11 11 pin=center .put pincircle_over 11 11 pin=center scale=90%
144 .put shadcircle 11 13 pin=center scale=90% .put outcircle_over 11 11 pin=center scale=90% .put pincircle_over 11 11 pin=center scale=79%
148 .put shadcircle 11 13 pin=center .put outcircle 11 11 pin=center .put mincircle 11 11 pin=center scale=90% luminance=60%
150 .sprite minusfaceover
151 .put shadcircle 11 13 pin=center .put outcircle_over 11 11 pin=center .put mincircle_over 11 11 pin=center scale=90%
153 .sprite minusfacedown
154 .put shadcircle 11 13 pin=center scale=90% .put outcircle_over 11 11 pin=center scale=90% .put mincircle_over 11 11 pin=center scale=79%
158 .put shadcircle 11 13 pin=center .put outcircle 11 11 pin=center .put incircle 13 11 pin=center scale=90%
161 .put shadcircle 11 13 pin=center .put outcircle_over 11 11 pin=center .put incircle_over 13 11 pin=center scale=90%
164 .put shadcircle 11 13 pin=center scale=90% .put outcircle_over 11 11 pin=center scale=90% .put incircle_over 13 11 pin=center scale=79%
168 .put shadcircle 11 13 pin=center .put outcircle 11 11 pin=center .put lincircle 9 11 pin=center scale=90%
171 .put shadcircle 11 13 pin=center .put outcircle_over 11 11 pin=center .put lincircle_over 9 11 pin=center scale=90%
174 .put shadcircle 11 13 pin=center scale=90% .put outcircle_over 11 11 pin=center scale=90% .put lincircle_over 9 11 pin=center scale=79%
178 .put shadcircle 11 13 pin=center .put outcircle 11 11 pin=center .put oincircle 9 11 pin=center scale=90% luminance=50%
181 .put shadcircle 11 13 pin=center .put outcircle_over 11 11 pin=center .put oincircle_over 9 11 pin=center scale=90%
184 .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%
188 .put shadcircle 11 13 pin=center .put outcircle 11 11 pin=center .put zincircle 10 11 pin=center scale=90% luminance=50%
191 .put shadcircle 11 13 pin=center .put outcircle_over 11 11 pin=center .put zincircle_over 10 11 pin=center scale=90%
194 .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%
199 .show outcircle as=area
200 .show rbfacedown as=pressed
201 .show rbfaceover as=hover
206 .show outcircle as=area
207 .show lbfacedown as=pressed
208 .show lbfaceover as=hover
212 .show plusface as=idle
213 .show outcircle as=area
214 .show plusfacedown as=pressed
215 .show plusfaceover as=hover
219 .show minusface as=idle
220 .show outcircle as=area
221 .show minusfacedown as=pressed
222 .show minusfaceover as=hover
227 .show outcircle as=area
228 .show obfacedown as=pressed
229 .show obfaceover as=hover
232 .button fullsizebutton
234 .show outcircle as=area
235 .show zbfacedown as=pressed
236 .show zbfaceover as=hover
239 #======================================== frame ===========================================================
243 .put p1=plusbutton x=width-25-20 y=20 pin=center
244 .put m1=minusbutton x=width-50-20 y=20 pin=center
245 .put o1=oneonebutton x=width-75-20 y=20 pin=center
246 .put z1=fullsizebutton x=width-100-20 y=20 pin=center
248 .put l1=leftbutton x=width/2-100 y=20 pin=center
249 .put r1=rightbutton x=width/2+100 y=20 pin=center
256 .box vscroll2_shadow line=0 fill=#00000033 width=14 height=100
258 .put vscroll2_shadow x=0 y=0 luminance=1.8
262 .box vscroll2 width=14 height=100 line=1 color=#00000060 fill=grad7
264 .put vscroll2 x=0 y=0 luminance=1.5
268 .box tick line=1 color=black width=8 height=0
270 .sprite t1 .put tt1=tick y=0 x=3 .end .put t1
271 .sprite t2 .put tt2=tick y=0 x=3 .end .put t2 y=50
272 .sprite t3 .put tt3=tick y=0 x=3 .end .put t3
274 .button vscrollbutton
275 .show vscroll2 as=area
277 startDrag(false, _parent.fullwidth-22, 40,
278 _parent.fullwidth-22, 40+_parent.scrollbaryrange);
279 _parent.Dragging = "v";
283 _parent.refreshDrag();
284 _parent.Dragging = "";
291 .box hscroll2_shadow width=100 line=0 fill=#00000033 height=14
293 .put hscroll2_shadow x=0 y=0 luminance=1.5
297 .box hscroll2 width=100 height=14 line=1 color=#00000060 fill=grad72
299 .put hscroll2 x=0 y=0 luminance=1.5
303 .box htick line=1 color=black width=0 height=8
305 .sprite th1 .put tht1=htick x=0 y=3 .end .put th1
306 .sprite th2 .put tht2=htick x=0 y=3 .end .put th2 x=50
307 .sprite th3 .put tht3=htick x=0 y=3 .end .put th3
309 .button hscrollbutton
310 .show hscroll2 as=area
312 startDrag(false, 10 , _parent.fullheight-22,
313 10+_parent.scrollbarxrange, _parent.fullheight-22);
314 _parent.Dragging = "h";
318 _parent.refreshDrag();
319 _parent.Dragging = "";
325 .put hscrollbar y=height-22 x=10
326 .put vscrollbar x=width-22 y=40
328 .edittext et width=110 height=20 font=arial size=18pt color=black noselect align=center
330 #.font dbgarial filename="Courier.ttf"
331 #.edittext debugtxt width=width height=20 font=dbgarial size=18pt color=#004000 noselect
334 .put et x=width/2-30 y=8
336 #.swf viewport filename=paper5.viewport
340 .box f width=100 height=100 line=0 fill=black
345 viewport.startDrag(false, left-scrollxrange, top-scrollyrange, left,top);
353 .put areabutton x=10 y=40
358 .put cliparea=cf x=10 y=40
359 .put viewport x=10 y=40
363 swfwidth = viewport._width;
364 swfheight = viewport._height;
368 Stage.scaleMode="noScale";
371 //Stage.showMenu = false;
373 fullwidth = Stage.width;
374 fullheight = Stage.height;
375 contentwidth = fullwidth - 40;
376 contentheight = fullheight - 70;
378 // move all objects to their proper positions
379 vscrollbar._x = fullwidth-22;
380 hscrollbar._y = fullheight-22;
381 p1._x = fullwidth-25-20 - p1._width/2;
382 o1._x = fullwidth-50-20 - o1._width/2;
383 z1._x = fullwidth-75-20 - z1._width/2;
384 m1._x = fullwidth-100-20 - m1._width/2;
386 l1._x = fullwidth/2-100 - l1._width/2;
387 r1._x = fullwidth/2+100 - r1._width/2;
389 et._x = fullwidth/2 - et._width/2;
391 //.box f width=width-40 height=height-40-30 line=0 fill=black
392 //.box vscroll1 width=10 height=height-40-30 line=1 color=#00000060 fill=grad7
393 //.box hscroll1 height=10 width=width-40 line=1 color=#00000060 fill=grad72
394 //.put vscroll1 x=width-20 y=40
395 //.put hscroll1 x=10 y=height-20
397 // horizontal scrollbar
398 background.lineStyle(1, 0, 0x60);
399 background.moveTo(10 ,fullheight-20);
400 background.lineTo(10 ,fullheight-10);
401 background.lineTo(10+fullwidth-40,fullheight-10);
402 background.lineTo(10+fullwidth-40,fullheight-20);
403 background.lineTo(10 ,fullheight-20);
405 // vertical scrollbar
406 background.moveTo(fullwidth-20 ,40);
407 background.lineTo(fullwidth-20 ,fullheight-30);
408 background.lineTo(fullwidth-10 ,fullheight-30);
409 background.lineTo(fullwidth-10 ,40);
410 background.lineTo(fullwidth-20 ,40);
413 background.lineStyle(1, 0);
414 background.startFill(0x000000);
415 background.moveTo(9, 39);
416 background.lineTo(fullwidth-30+1, 39);
417 background.lineTo(fullwidth-30+1, fullheight-29);
418 background.lineTo(9, fullheight-29);
419 background.lineTo(9, 39);
420 background.endFill();
422 areabutton._xscale = contentwidth;
423 areabutton._yscale = contentheight;
424 cliparea._xscale = contentwidth;
425 cliparea._yscale = contentheight;
426 viewport.setMask(cliparea);
433 //debugtxt.text = Stage.width+ " x " + Stage.height;
434 //debugtxt.text = zoomtype;
436 setPageNr = function() {
437 et.text = " "+pagenr+" / "+viewport._totalframes;
438 viewport.gotoAndStop(pagenr);
441 setNoScrollZoomLevel = function() {
442 // determine initial zoom level
443 xscale = contentwidth / swfwidth;
444 yscale = contentheight / swfheight;
445 if(xscale < yscale) {
454 setOneDirScrollZoomLevel = function() {
455 xscale = contentwidth / swfwidth;
456 yscale = contentheight / swfheight;
457 if(xscale > yscale) {
466 set11ZoomLevel = function() {
471 swfpos2scrollbars = function() {
473 hscrollbar._x = 10 + (left-viewport._x)*scrollbarxrange/scrollxrange;
478 vscrollbar._y = 40 + (top-viewport._y)*scrollbaryrange/scrollyrange;
483 setZoomLevel = function() {
485 width = contentwidth;
486 height = contentheight;
490 if(swfwidth * zoom < contentwidth) {
491 width = swfwidth*zoom;
492 left = 10+(contentwidth-width)/2;
494 if(swfheight * zoom < contentheight) {
495 height = swfheight*zoom;
496 top = 40+(contentheight-height)/2;
499 scrollxrange = swfwidth*zoom-width;
500 scrollyrange = swfheight*zoom-height;
502 hscrollbar._xscale = (contentwidth*width) / (swfwidth*zoom);
503 vscrollbar._yscale = (contentheight*height) / (swfheight*zoom);
504 scrollbarxrange = contentwidth - hscrollbar._xscale;
505 scrollbaryrange = contentheight - vscrollbar._yscale;
506 if(scrollbarxrange<0) {
509 if(scrollbaryrange<0) {
513 viewport._xscale = zoom*100;
514 viewport._yscale = zoom*100;
516 focusx = contentwidth/2 - (viewport._x-10);
517 focusy = contentheight/2 - (viewport._y-40);
519 viewport._x = left - focusx * zoom / lastzoom + width/2;
520 viewport._y = top - focusy * zoom / lastzoom + height/2;
522 if(viewport._x > left) {
524 } else if(viewport._x < left-scrollxrange) {
525 viewport._x = left-scrollxrange;
527 if(viewport._y > top) {
529 } else if(viewport._y < top-scrollyrange) {
530 viewport._y = top-scrollyrange;
536 hscrollbar._visible = 1;
538 //hscrollbar._visible = 0;
541 vscrollbar._visible = 1;
543 //vscrollbar._visible = 0;
548 // update the ruler decorations
550 vscrollbar.t1._y = vscrollbar.t2._y - 600.0/vscrollbar._yscale;
551 vscrollbar.t3._y = vscrollbar.t2._y + 600.0/vscrollbar._yscale;
552 hscrollbar.th1._x = hscrollbar.th2._x - 600.0/hscrollbar._xscale;
553 hscrollbar.th3._x = hscrollbar.th2._x + 700.0/hscrollbar._xscale;
555 vscrollbar.vshadow._x = vscrollbar.vbox._x + 500/vscrollbar._xscale;
556 vscrollbar.vshadow._y = vscrollbar.vbox._y + 500/vscrollbar._yscale;
558 hscrollbar.hshadow._x = hscrollbar.hbox._x + 500/hscrollbar._xscale;
559 hscrollbar.hshadow._y = hscrollbar.hbox._y + 500/hscrollbar._yscale;
567 } else if(zoomtype=="2") {
568 setNoScrollZoomLevel();
570 setOneDirScrollZoomLevel();
573 l1.onRelease = function(){
579 r1.onRelease = function(){
580 if(pagenr < viewport._totalframes) {
585 p1.onRelease = function(){
591 m1.onRelease = function(){
599 o1.onRelease = function(){
600 setNoScrollZoomLevel();
602 z1.onRelease = function(){
603 setOneDirScrollZoomLevel();
605 refreshDrag = function(){
606 if(Dragging == "h") {
607 viewport._x = left + (10-hscrollbar._x)*scrollxrange/scrollbarxrange;
608 } else if(Dragging == "v") {
609 viewport._y = top + (40-vscrollbar._y)*scrollyrange/scrollbaryrange;
610 } else if(Dragging == "xy") {
614 dragrefresh = setInterval(refreshDrag, 20);