Rev 8312 | Rev 8347 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8312 | Rev 8322 | ||
---|---|---|---|
Line 1179... | Line 1179... | ||
1179 | if( use_input_xy != 0 ){canvas_error("userinput_xy can not be combined with usertextarea_xy command");} |
1179 | if( use_input_xy != 0 ){canvas_error("userinput_xy can not be combined with usertextarea_xy command");} |
1180 | if( use_safe_eval == FALSE){use_safe_eval = TRUE;add_safe_eval(js_include_file);} /* just once */ |
1180 | if( use_safe_eval == FALSE){use_safe_eval = TRUE;add_safe_eval(js_include_file);} /* just once */ |
1181 | use_input_xy = 1; |
1181 | use_input_xy = 1; |
1182 | break; |
1182 | break; |
1183 | case FUNCTION_LABEL: |
1183 | case FUNCTION_LABEL: |
- | 1184 | /* |
|
- | 1185 | @ functionlabel 'some string' |
|
- | 1186 | @ default value "f(x)=" |
|
- | 1187 | @ no mathml allowed (just ascii string) |
|
- | 1188 | @ if needed, use before every command 'userinput function | inputfield | textarea' |
|
- | 1189 | */ |
|
1184 | function_label = get_string_argument(infile,1); |
1190 | function_label = get_string_argument(infile,1); |
1185 | break; |
1191 | break; |
1186 | case USERINPUT_FUNCTION: |
1192 | case USERINPUT_FUNCTION: |
1187 | /* |
1193 | /* |
1188 | @ userinput_function |
1194 | @ userinput_function |
Line 3125... | Line 3131... | ||
3125 | @ replyformat number |
3131 | @ replyformat number |
3126 | @ use number=-1 to deactivate the js-functions read_canvas() and read_dragdrop() |
3132 | @ use number=-1 to deactivate the js-functions read_canvas() and read_dragdrop() |
3127 | @ default values should be fine ! |
3133 | @ default values should be fine ! |
3128 | @ use command 'precision [0,1,10,100,1000,10000...]' before command 'replyformat' to set the desired number of decimals in the student reply / drawing |
3134 | @ use command 'precision [0,1,10,100,1000,10000...]' before command 'replyformat' to set the desired number of decimals in the student reply / drawing |
3129 | @ the last value for 'precision int' will be used to calculate the reply coordinates, if needed (read_canvas();) |
3135 | @ the last value for 'precision int' will be used to calculate the reply coordinates, if needed (read_canvas();) |
3130 | @ choose<ul><li>1 = x1,x2,x3,x4....x_n<br />y1,y2,y3,y4....y_n<br /><br />x/y in pixels</li><li>2 = x1,x2,x3,x4....x_n<br /> y1,y2,y3,y4....y_n<br /> x/y in xrange / yrange coordinate system<br /></li><li>3 = x1,x2,x3,x4....x_n<br /> y1,y2,y3,y4....y_n<br /> r1,r2,r3,r4....r_n<br /> x/y in pixels <br /> r in pixels</li><li>4 = x1,x2,x3,x4....x_n<br /> y1,y2,y3,y4....y_n<br /> r1,r2,r3,r4....r_n<br /> x/y in xrange / yrange coordinate system<br /> r in pixels</li><li>5 = Ax1,Ax2,Ax3,Ax4....Ax_n<br /> Ay1,Ay2,Ay3,Ay4....Ay_n<br /> Bx1,Bx2,Bx3,Bx4....Bx_n<br /> By1,By2,By3,By4....By_n<br /> Cx1,Cx2,Cx3,Cx4....Cx_n<br /> Cy1,Cy2,Cy3,Cy4....Cy_n<br /> ....<br /> Zx1,Zx2,Zx3,Zx4....Zx_n<br /> Zy1,Zy2,Zy3,Zy4....Zy_n<br /> x/y in pixels<br /></li><li>6 = Ax1,Ax2,Ax3,Ax4....Ax_n<br /> Ay1,Ay2,Ay3,Ay4....Ay_n<br /> Bx1,Bx2,Bx3,Bx4....Bx_n<br /> By1,By2,By3,By4....By_n<br /> Cx1,Cx2,Cx3,Cx4....Cx_n<br /> Cy1,Cy2,Cy3,Cy4....Cy_n<br /> ....<br /> Zx1,Zx2,Zx3,Zx4....Zx_n<br /> Zy1,Zy2,Zy3,Zy4....Zy_n<br /> x/y in xrange / yrange coordinate system<br /></li><li>7 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n<br /> x/y in pixels</li><li>8 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n<br /> x/y in xrange / yrange coordinate system</li><li>9 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n<br /> x/y in pixels</li><li>10 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n<br /> x/y in xrange / yrange coordinate system</li><li>11 = Ax1,Ay1,Ax2,Ay2<br /> Bx1,By1,Bx2,By2<br /> Cx1,Cy1,Cx2,Cy2<br /> Dx1,Dy1,Dx2,Dy2<br /> ......<br /> Zx1,Zy1,Zx2,Zy2<br /> x/y in xrange / yrange coordinate system</li><li>12 = Ax1,Ay1,Ax2,Ay2<br /> Bx1,By1,Bx2,By2<br />Cx1,Cy1,Cx2,Cy2<br /> Dx1,Dy1,Dx2,Dy2<br /> ......<br /> Zx1,Zy1,Zx2,Zy2<br /> x/y in pixels</li><li>13 = Ax1:Ay1:Ax2:Ay2,Bx1:By1:Bx2:By2,Cx1:Cy1:Cx2:Cy2,Dx1:Dy1:Dx2:Dy2, ... ,Zx1:Zy1:Zx2:Zy2<br /> x/y in xrange / yrange coordinate system</li><li>14 = Ax1:Ay1:Ax2:Ay2,Bx1:By1:Bx2:By2....Zx1:Zy1:Zx2:Zy2<br /> x/y in pixels</li><li>15 = reply from inputfields,textareas<br /> reply1,reply2,reply3,...,reply_n</li><li>16 = mathml input fields </li><li>17 = read "userdraw text,color" only (x1:y1:text1,x2:y2:text2...x_n:y_n:text_n</li><li>18 = read_canvas() will read all interactive clocks in H1:M1:S1,H2:M2:S2...Hn:Mn:Sn</li><li>19 = read_canvas() will return the object number of marked / clicked object (clock)<br />analogue to (shape library) onclick command </li><li>21 = (x1:y1) (x2:y2) ... (x_n:y_n)<br />verbatim coordinate return</li>22 = returns an array .... reply[0]=x1 reply[1]=y1 reply[2]=x2 reply[3]=y2 ... reply[n-1]=x_n reply[n]=y_n<br /> x/y in xrange / yrange coordinate system</li><li>replyformat 23 : can only be used for drawtype 'polyline'<br />a typical click sequence in drawtype polyline isx1,y1,x2,y2,x2,y2,x3,y3,x3,y3.....,x(n-1),y(n-1),x(n-1),y(n-1),xn,yn --replyformat 23--> x1,y1,x2,y2,x3,y3,.....x(n-1),y(n-1),xn,yn multiple occurences will be filtered out.The reply will be in x-y-range (xreply \\n yreply)</li><li>replyformat 24 = read all inputfield values: even those set 'readonly'</li><li>format 25 = angle1,angle2...angle_n : will return the radius (one or many) of the user drawn circle segment in degrees </li><li>format 26 = rad1,rad2...rad_n : will return the radius (one or many) of the user drawn circle segment in radians </li><li>27 = return (only) userdraw inputfields array: x1:y1:text1,x2:y2:text2...</li></ul> |
3136 | @ choose<ul><li>1 = x1,x2,x3,x4....x_n<br />y1,y2,y3,y4....y_n<br /><br />x/y in pixels</li><li>2 = x1,x2,x3,x4....x_n<br /> y1,y2,y3,y4....y_n<br /> x/y in xrange / yrange coordinate system<br /></li><li>3 = x1,x2,x3,x4....x_n<br /> y1,y2,y3,y4....y_n<br /> r1,r2,r3,r4....r_n<br /> x/y in pixels <br /> r in pixels</li><li>4 = x1,x2,x3,x4....x_n<br /> y1,y2,y3,y4....y_n<br /> r1,r2,r3,r4....r_n<br /> x/y in xrange / yrange coordinate system<br /> r in pixels</li><li>5 = Ax1,Ax2,Ax3,Ax4....Ax_n<br /> Ay1,Ay2,Ay3,Ay4....Ay_n<br /> Bx1,Bx2,Bx3,Bx4....Bx_n<br /> By1,By2,By3,By4....By_n<br /> Cx1,Cx2,Cx3,Cx4....Cx_n<br /> Cy1,Cy2,Cy3,Cy4....Cy_n<br /> ....<br /> Zx1,Zx2,Zx3,Zx4....Zx_n<br /> Zy1,Zy2,Zy3,Zy4....Zy_n<br /> x/y in pixels<br /></li><li>6 = Ax1,Ax2,Ax3,Ax4....Ax_n<br /> Ay1,Ay2,Ay3,Ay4....Ay_n<br /> Bx1,Bx2,Bx3,Bx4....Bx_n<br /> By1,By2,By3,By4....By_n<br /> Cx1,Cx2,Cx3,Cx4....Cx_n<br /> Cy1,Cy2,Cy3,Cy4....Cy_n<br /> ....<br /> Zx1,Zx2,Zx3,Zx4....Zx_n<br /> Zy1,Zy2,Zy3,Zy4....Zy_n<br /> x/y in xrange / yrange coordinate system<br /></li><li>7 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n<br /> x/y in pixels</li><li>8 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n<br /> x/y in xrange / yrange coordinate system</li><li>9 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n<br /> x/y in pixels</li><li>10 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n<br /> x/y in xrange / yrange coordinate system</li><li>11 = Ax1,Ay1,Ax2,Ay2<br /> Bx1,By1,Bx2,By2<br /> Cx1,Cy1,Cx2,Cy2<br /> Dx1,Dy1,Dx2,Dy2<br /> ......<br /> Zx1,Zy1,Zx2,Zy2<br /> x/y in xrange / yrange coordinate system</li><li>12 = Ax1,Ay1,Ax2,Ay2<br /> Bx1,By1,Bx2,By2<br />Cx1,Cy1,Cx2,Cy2<br /> Dx1,Dy1,Dx2,Dy2<br /> ......<br /> Zx1,Zy1,Zx2,Zy2<br /> x/y in pixels</li><li>13 = Ax1:Ay1:Ax2:Ay2,Bx1:By1:Bx2:By2,Cx1:Cy1:Cx2:Cy2,Dx1:Dy1:Dx2:Dy2, ... ,Zx1:Zy1:Zx2:Zy2<br /> x/y in xrange / yrange coordinate system</li><li>14 = Ax1:Ay1:Ax2:Ay2,Bx1:By1:Bx2:By2....Zx1:Zy1:Zx2:Zy2<br /> x/y in pixels</li><li>15 = reply from inputfields,textareas<br /> reply1,reply2,reply3,...,reply_n</li><li>16 = mathml input fields </li><li>17 = read "userdraw text,color" only (x1:y1:text1,x2:y2:text2...x_n:y_n:text_n</li><li>18 = read_canvas() will read all interactive clocks in H1:M1:S1,H2:M2:S2...Hn:Mn:Sn</li><li>19 = read_canvas() will return the object number of marked / clicked object (clock)<br />analogue to (shape library) onclick command </li><li>21 = (x1:y1) (x2:y2) ... (x_n:y_n)<br />verbatim coordinate return</li>22 = returns an array .... reply[0]=x1 reply[1]=y1 reply[2]=x2 reply[3]=y2 ... reply[n-1]=x_n reply[n]=y_n<br /> x/y in xrange / yrange coordinate system</li><li>replyformat 23 : can only be used for drawtype 'polyline'<br />a typical click sequence in drawtype polyline isx1,y1,x2,y2,x2,y2,x3,y3,x3,y3.....,x(n-1),y(n-1),x(n-1),y(n-1),xn,yn --replyformat 23--> x1,y1,x2,y2,x3,y3,.....x(n-1),y(n-1),xn,yn multiple occurences will be filtered out.The reply will be in x-y-range (xreply \\n yreply)</li><li>replyformat 24 = read all inputfield values: even those set 'readonly'</li><li>format 25 = angle1,angle2...angle_n : will return the radius (one or many) of the user drawn circle segment in degrees </li><li>format 26 = rad1,rad2...rad_n : will return the radius (one or many) of the user drawn circle segment in radians </li><li>27 = return (only) userdraw inputfields array: x1:y1:text1,x2:y2:text2...</li><li>28 = x1,y1,r1,x2,y2,r2...x_n,y_n,r_n <br />x / y / r in xrange / yrange coordinate system: may be used to reinput into command 'circles color,x1,y1,r1,x2,y2,r2...x_n,y_n,r_n'<br /> will not return anything else (e.g. no inputfields , text etc)</li></ul> |
3131 | @ note to 'userdraw text,color' : the x / y-values are in pixels ! (this to avoid too lengthy calculations in javascript...) |
3137 | @ note to 'userdraw text,color' : the x / y-values are in pixels ! (this to avoid too lengthy calculations in javascript...) |
3132 | */ |
3138 | */ |
3133 | reply_format = (int) get_real(infile,1); |
3139 | reply_format = (int) get_real(infile,1); |
3134 | reply_precision = precision; |
3140 | reply_precision = precision; |
3135 | break; |
3141 | break; |
Line 3451... | Line 3457... | ||
3451 | } |
3457 | } |
3452 | /* we are done parsing script file */ |
3458 | /* we are done parsing script file */ |
3453 | /* check if xrange / yrange was set explicit ... or use xmin=0 xmax=xsize ymin=0 ymax=ysize : Quadrant I */ |
3459 | /* check if xrange / yrange was set explicit ... or use xmin=0 xmax=xsize ymin=0 ymax=ysize : Quadrant I */ |
3454 | if( found_size_command == 1 ){ |
3460 | if( found_size_command == 1 ){ |
3455 | fprintf(js_include_file,"var xmin = 0;var xmax = %d;var ymin = 0;var ymax = %d",xsize,ysize); |
3461 | fprintf(js_include_file,"var xmin = 0;var xmax = %d;var ymin = 0;var ymax = %d",xsize,ysize); |
3456 | } |
3462 | } |
3457 | else |
3463 | else |
3458 | { |
3464 | { |
3459 | if( found_size_command != 3 ){ |
3465 | if( found_size_command != 3 ){ |
3460 | canvas_error("Please specify both xrange and yrange ..."); |
3466 | canvas_error("Please specify both xrange and yrange ..."); |
3461 | } |
3467 | } |
Line 3664... | Line 3670... | ||
3664 | if( ( c == '\n' || c == EOF) && last == 0){canvas_error("expecting more arguments in command");} |
3670 | if( ( c == '\n' || c == EOF) && last == 0){canvas_error("expecting more arguments in command");} |
3665 | if( c == '\n') { line_number++; } |
3671 | if( c == '\n') { line_number++; } |
3666 | if( c == EOF ) {finished = 1;} |
3672 | if( c == EOF ) {finished = 1;} |
3667 | if( finished == 1 && last != 1 ){ canvas_error("expected more arguments");} |
3673 | if( finished == 1 && last != 1 ){ canvas_error("expected more arguments");} |
3668 | temp[i]='\0'; |
3674 | temp[i]='\0'; |
- | 3675 | /* |
|
- | 3676 | 17.10.2014 removed (question Perrin) |
|
- | 3677 | may cause some unwanted effects... |
|
3669 | if( strlen(temp) == 0 ){ canvas_error("expected a word or string (without comma) , but found nothing !!");} |
3678 | if( strlen(temp) == 0 ){ canvas_error("expected a word or string (without comma) , but found nothing !!");} |
- | 3679 | */ |
|
3670 | string=(char *)my_newmem(sizeof(temp)); |
3680 | string=(char *)my_newmem(sizeof(temp)); |
3671 | snprintf(string,sizeof(temp),"%s",temp); |
3681 | snprintf(string,sizeof(temp),"%s",temp); |
3672 | done = TRUE; |
3682 | done = TRUE; |
3673 | return string; |
3683 | return string; |
3674 | } |
3684 | } |
Line 3786... | Line 3796... | ||
3786 | y1,y2,y3,y4....y_n |
3796 | y1,y2,y3,y4....y_n |
3787 | r1,r2,r3,r4....r_n |
3797 | r1,r2,r3,r4....r_n |
3788 | 3798 | ||
3789 | x/y in xrange / yrange coordinate system |
3799 | x/y in xrange / yrange coordinate system |
3790 | r in pixels |
3800 | r in pixels |
3791 | 3801 | ||
3792 | 5 = Ax1,Ax2,Ax3,Ax4....Ax_n |
3802 | 5 = Ax1,Ax2,Ax3,Ax4....Ax_n |
3793 | Ay1,Ay2,Ay3,Ay4....Ay_n |
3803 | Ay1,Ay2,Ay3,Ay4....Ay_n |
3794 | Bx1,Bx2,Bx3,Bx4....Bx_n |
3804 | Bx1,Bx2,Bx3,Bx4....Bx_n |
3795 | By1,By2,By3,By4....By_n |
3805 | By1,By2,By3,By4....By_n |
3796 | Cx1,Cx2,Cx3,Cx4....Cx_n |
3806 | Cx1,Cx2,Cx3,Cx4....Cx_n |
3797 | Cy1,Cy2,Cy3,Cy4....Cy_n |
3807 | Cy1,Cy2,Cy3,Cy4....Cy_n |
3798 | .... |
3808 | .... |
3799 | Zx1,Zx2,Zx3,Zx4....Zx_n |
3809 | Zx1,Zx2,Zx3,Zx4....Zx_n |
3800 | Zy1,Zy2,Zy3,Zy4....Zy_n |
3810 | Zy1,Zy2,Zy3,Zy4....Zy_n |
3801 | 3811 | ||
3802 | x/y in pixels |
3812 | x/y in pixels |
Line 3807... | Line 3817... | ||
3807 | By1,By2,By3,By4....By_n |
3817 | By1,By2,By3,By4....By_n |
3808 | Cx1,Cx2,Cx3,Cx4....Cx_n |
3818 | Cx1,Cx2,Cx3,Cx4....Cx_n |
3809 | Cy1,Cy2,Cy3,Cy4....Cy_n |
3819 | Cy1,Cy2,Cy3,Cy4....Cy_n |
3810 | .... |
3820 | .... |
3811 | Zx1,Zx2,Zx3,Zx4....Zx_n |
3821 | Zx1,Zx2,Zx3,Zx4....Zx_n |
3812 | Zy1,Zy2,Zy3,Zy4....Zy_n |
3822 | Zy1,Zy2,Zy3,Zy4....Zy_n |
3813 | 3823 | ||
3814 | x/y in xrange / yrange coordinate system |
3824 | x/y in xrange / yrange coordinate system |
3815 | 3825 | ||
3816 | 7 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n |
3826 | 7 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n |
3817 | 3827 | ||
3818 | x/y in pixels |
3828 | x/y in pixels |
3819 | 3829 | ||
3820 | 8 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n |
3830 | 8 = x1:y1,x2:y2,x3:y3,x4:y4...x_n:y_n |
3821 | 3831 | ||
3822 | x/y in xrange / yrange coordinate system |
3832 | x/y in xrange / yrange coordinate system |
3823 | 3833 | ||
3824 | 9 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n |
3834 | 9 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n |
3825 | 3835 | ||
3826 | x/y in pixels |
3836 | x/y in pixels |
3827 | 3837 | ||
3828 | 10 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n |
3838 | 10 = x1:y1:r1,x2:y2:r2,x3:y3:r3,x4:y4:r3...x_n:y_n:r_n |
3829 | 3839 | ||
3830 | x/y in xrange / yrange coordinate system |
3840 | x/y in xrange / yrange coordinate system |
3831 | 3841 | ||
3832 | 11 = Ax1,Ay1,Ax2,Ay2 |
3842 | 11 = Ax1,Ay1,Ax2,Ay2 |
3833 | Bx1,By1,Bx2,By2 |
3843 | Bx1,By1,Bx2,By2 |
3834 | Cx1,Cy1,Cx2,Cy2 |
3844 | Cx1,Cy1,Cx2,Cy2 |
3835 | Dx1,Dy1,Dx2,Dy2 |
3845 | Dx1,Dy1,Dx2,Dy2 |
3836 | ...... |
3846 | ...... |
3837 | Zx1,Zy1,Zx2,Zy2 |
3847 | Zx1,Zy1,Zx2,Zy2 |
3838 | 3848 | ||
3839 | x/y in xrange / yrange coordinate system |
3849 | x/y in xrange / yrange coordinate system |
3840 | 3850 | ||
3841 | 12 = Ax1,Ay1,Ax2,Ay2 |
3851 | 12 = Ax1,Ay1,Ax2,Ay2 |
3842 | Bx1,By1,Bx2,By2 |
3852 | Bx1,By1,Bx2,By2 |
3843 | Cx1,Cy1,Cx2,Cy2 |
3853 | Cx1,Cy1,Cx2,Cy2 |
3844 | Dx1,Dy1,Dx2,Dy2 |
3854 | Dx1,Dy1,Dx2,Dy2 |
3845 | ...... |
3855 | ...... |
3846 | Zx1,Zy1,Zx2,Zy2 |
3856 | Zx1,Zy1,Zx2,Zy2 |
3847 | 3857 | ||
3848 | x/y in pixels |
3858 | x/y in pixels |
3849 | 3859 | ||
3850 | 13 = Ax1:Ay1:Ax2:Ay2,Bx1:By1:Bx2:By2,Cx1:Cy1:Cx2:Cy2,Dx1:Dy1:Dx2:Dy2, ... ,Zx1:Zy1:Zx2:Zy2 |
3860 | 13 = Ax1:Ay1:Ax2:Ay2,Bx1:By1:Bx2:By2,Cx1:Cy1:Cx2:Cy2,Dx1:Dy1:Dx2:Dy2, ... ,Zx1:Zy1:Zx2:Zy2 |
3851 | 3861 | ||
3852 | x/y in xrange / yrange coordinate system |
3862 | x/y in xrange / yrange coordinate system |
Line 3870... | Line 3880... | ||
3870 | 23 = answertype for a polyline : remove multiple occurences due to reclick on a point to create next polyline segment |
3880 | 23 = answertype for a polyline : remove multiple occurences due to reclick on a point to create next polyline segment |
3871 | 24 = read all inputfield values: even those set 'readonly' |
3881 | 24 = read all inputfield values: even those set 'readonly' |
3872 | 25 = return all userdrawn arcs in degrees: |
3882 | 25 = return all userdrawn arcs in degrees: |
3873 | 26 = return all userdrawn arcs in radians: |
3883 | 26 = return all userdrawn arcs in radians: |
3874 | 27 = return (only) userdraw inputfields array: x1:y1:text1,x2:y2:text2... |
3884 | 27 = return (only) userdraw inputfields array: x1:y1:text1,x2:y2:text2... |
- | 3885 | 28 = x1,y1,r1,x2,y2,r2...x_n,y_n,r_n |
|
- | 3886 | x/y/r in xrange / yrange coordinate system: may be used to reinput into command |
|
- | 3887 | 'circles color,x1,y1,r1,x2,y2,r2...x_n,y_n,r_n' |
|
- | 3888 | will not return anything else (e.g. no inputfields , text etc) |
|
3875 | */ |
3889 | */ |
3876 | 3890 | ||
3877 | 3891 | ||
3878 | void add_read_canvas(int canvas_root_id,int type_reply,int reply_precision){ |
3892 | void add_read_canvas(int canvas_root_id,int type_reply,int reply_precision){ |
3879 | /* just 1 reply type allowed */ |
3893 | /* just 1 reply type allowed */ |
3880 | fprintf(js_include_file,"\ |
3894 | fprintf(js_include_file,"\ |
Line 3899... | Line 3913... | ||
3899 | answers may have: |
3913 | answers may have: |
3900 | x-values,y-values,r-values,input-fields,mathml-inputfields,text-typed answers |
3914 | x-values,y-values,r-values,input-fields,mathml-inputfields,text-typed answers |
3901 | */ |
3915 | */ |
3902 | case 1: fprintf(js_include_file,"\ |
3916 | case 1: fprintf(js_include_file,"\ |
3903 | \n<!-- begin function 1 read_canvas%d() -->\n\ |
3917 | \n<!-- begin function 1 read_canvas%d() -->\n\ |
3904 | read_canvas%d = function(){\ |
3918 | read_canvas%d = function(){\ |
3905 | if( userdraw_x.length == 0){alert(\"nothing drawn...\");return;}\ |
3919 | if( userdraw_x.length == 0){alert(\"nothing drawn...\");return;}\ |
3906 | set_reply_precision();\ |
3920 | set_reply_precision();\ |
3907 | if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\ |
3921 | if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\ |
3908 | var p = 0;var input_reply = new Array();\ |
3922 | var p = 0;var input_reply = new Array();\ |
3909 | if( document.getElementById(\"canvas_input0\")){\ |
3923 | if( document.getElementById(\"canvas_input0\")){\ |
3910 | var t = 0;\ |
3924 | var t = 0;\ |
3911 | while(document.getElementById(\"canvas_input\"+t)){\ |
3925 | while(document.getElementById(\"canvas_input\"+t)){\ |
3912 | if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\ |
3926 | if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\ |
3913 | input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\ |
3927 | input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\ |
3914 | p++;\ |
3928 | p++;\ |
3915 | };\ |
3929 | };\ |
3916 | t++;\ |
3930 | t++;\ |
3917 | };\ |
3931 | };\ |
3918 | };\ |
3932 | };\ |
3919 | if( typeof userdraw_text != 'undefined' ){\ |
3933 | if( typeof userdraw_text != 'undefined' ){\ |
3920 | return userdraw_x+\"\\n\"+userdraw_y+\"\\n\"+input_reply + \"\\n\"+userdraw_text;\ |
3934 | return userdraw_x+\"\\n\"+userdraw_y+\"\\n\"+input_reply + \"\\n\"+userdraw_text;\ |
3921 | }\ |
3935 | }\ |
3922 | else\ |
3936 | else\ |
3923 | {\ |
3937 | {\ |
3924 | return userdraw_x+\"\\n\"+userdraw_y+\"\\n\"+input_reply;\ |
3938 | return userdraw_x+\"\\n\"+userdraw_y+\"\\n\"+input_reply;\ |
3925 | }\ |
3939 | }\ |
3926 | }\ |
3940 | }\ |
3927 | else\ |
3941 | else\ |
3928 | {\ |
3942 | {\ |
3929 | if( typeof userdraw_text != 'undefined' ){\ |
3943 | if( typeof userdraw_text != 'undefined' ){\ |
3930 | return userdraw_x+\"\\n\"+userdraw_y+\"\\n\"+userdraw_text;\ |
3944 | return userdraw_x+\"\\n\"+userdraw_y+\"\\n\"+userdraw_text;\ |
Line 3962... | Line 3976... | ||
3962 | t++;\ |
3976 | t++;\ |
3963 | };\ |
3977 | };\ |
3964 | };\ |
3978 | };\ |
3965 | if( typeof userdraw_text != 'undefined' ){\ |
3979 | if( typeof userdraw_text != 'undefined' ){\ |
3966 | return reply_x+\"\\n\"+reply_y+\"\\n\"+input_reply+\"\\n\"+userdraw_text;\ |
3980 | return reply_x+\"\\n\"+reply_y+\"\\n\"+input_reply+\"\\n\"+userdraw_text;\ |
3967 | }\ |
3981 | }\ |
3968 | else\ |
3982 | else\ |
3969 | {\ |
3983 | {\ |
3970 | return reply_x+\"\\n\"+reply_y+\"\\n\"+input_reply;\ |
3984 | return reply_x+\"\\n\"+reply_y+\"\\n\"+input_reply;\ |
3971 | }\ |
3985 | }\ |
3972 | }\ |
3986 | }\ |
Line 4075... | Line 4089... | ||
4075 | set_reply_precision();\ |
4089 | set_reply_precision();\ |
4076 | var p = 0;\ |
4090 | var p = 0;\ |
4077 | var reply = \"\";\ |
4091 | var reply = \"\";\ |
4078 | for(p = 0; p < userdraw_x.length;p++){\ |
4092 | for(p = 0; p < userdraw_x.length;p++){\ |
4079 | if(userdraw_x[p] != null ){\ |
4093 | if(userdraw_x[p] != null ){\ |
4080 | reply = reply + userdraw_x[p]+\"\\n\"+userdraw_y[p]+\"\\n\";\ |
4094 | reply = reply + userdraw_x[p]+\"\\n\"+userdraw_y[p]+\"\\n\";\ |
4081 | };\ |
4095 | };\ |
4082 | };\ |
4096 | };\ |
4083 | if(p == 0){alert(\"nothing drawn...\");return;};\ |
4097 | if(p == 0){alert(\"nothing drawn...\");return;};\ |
4084 | userdraw_x = [];userdraw_y = [];\ |
4098 | userdraw_x = [];userdraw_y = [];\ |
4085 | if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\ |
4099 | if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\ |
4086 | var p = 0;var input_reply = new Array();\ |
4100 | var p = 0;var input_reply = new Array();\ |
Line 4104... | Line 4118... | ||
4104 | }\ |
4118 | }\ |
4105 | else\ |
4119 | else\ |
4106 | {\ |
4120 | {\ |
4107 | if( typeof userdraw_text != 'undefined' ){\ |
4121 | if( typeof userdraw_text != 'undefined' ){\ |
4108 | return reply+\"\\n\"+userdraw_text;\ |
4122 | return reply+\"\\n\"+userdraw_text;\ |
4109 | }\ |
4123 | }\ |
4110 | else\ |
4124 | else\ |
4111 | {\ |
4125 | {\ |
4112 | return reply;\ |
4126 | return reply;\ |
4113 | }\ |
4127 | }\ |
4114 | };\ |
4128 | };\ |
Line 4132... | Line 4146... | ||
4132 | tmp_y = userdraw_y[p];\ |
4146 | tmp_y = userdraw_y[p];\ |
4133 | if(tmp_x != null){\ |
4147 | if(tmp_x != null){\ |
4134 | for(var i = 0 ; i < tmp_x.length ; i++){\ |
4148 | for(var i = 0 ; i < tmp_x.length ; i++){\ |
4135 | tmp_x[i] = (Math.round(prec*(px2x(tmp_x[i]))))/prec;\ |
4149 | tmp_x[i] = (Math.round(prec*(px2x(tmp_x[i]))))/prec;\ |
4136 | tmp_y[i] = (Math.round(prec*(px2y(tmp_y[i]))))/prec;\ |
4150 | tmp_y[i] = (Math.round(prec*(px2y(tmp_y[i]))))/prec;\ |
4137 | };\ |
4151 | };\ |
4138 | reply = reply + tmp_x + \"\\n\" + tmp_y +\"\\n\";\ |
4152 | reply = reply + tmp_x + \"\\n\" + tmp_y +\"\\n\";\ |
4139 | };\ |
4153 | };\ |
4140 | };\ |
4154 | };\ |
4141 | if(p == 0){alert(\"nothing drawn...\");return;};\ |
4155 | if(p == 0){alert(\"nothing drawn...\");return;};\ |
4142 | userdraw_x = [];userdraw_y = [];\ |
4156 | userdraw_x = [];userdraw_y = [];\ |
4143 | if( document.getElementById(\"canvas_input0\") ){\ |
4157 | if( document.getElementById(\"canvas_input0\") ){\ |
4144 | var p = 0;var input_reply = new Array();\ |
4158 | var p = 0;var input_reply = new Array();\ |
4145 | if( document.getElementById(\"canvas_input0\")){\ |
4159 | if( document.getElementById(\"canvas_input0\")){\ |
4146 | var t = 0;\ |
4160 | var t = 0;\ |
4147 | while(document.getElementById(\"canvas_input\"+t)){\ |
4161 | while(document.getElementById(\"canvas_input\"+t)){\ |
4148 | if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\ |
4162 | if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\ |
4149 | input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\ |
4163 | input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\ |
4150 | p++;\ |
4164 | p++;\ |
4151 | };\ |
4165 | };\ |
4152 | t++;\ |
4166 | t++;\ |
4153 | };\ |
4167 | };\ |
Line 4167... | Line 4181... | ||
4167 | }\ |
4181 | }\ |
4168 | else\ |
4182 | else\ |
4169 | {\ |
4183 | {\ |
4170 | return reply;\ |
4184 | return reply;\ |
4171 | }\ |
4185 | }\ |
4172 | };\ |
4186 | };\ |
4173 | };\n\ |
4187 | };\n\ |
4174 | <!-- end function 6 read_canvas%d() -->",canvas_root_id,canvas_root_id,reply_precision,canvas_root_id); |
4188 | <!-- end function 6 read_canvas%d() -->",canvas_root_id,canvas_root_id,reply_precision,canvas_root_id); |
4175 | break; |
4189 | break; |
4176 | case 7: fprintf(js_include_file,"\ |
4190 | case 7: fprintf(js_include_file,"\ |
4177 | \n<!-- begin function 7 read_canvas%d() -->\n\ |
4191 | \n<!-- begin function 7 read_canvas%d() -->\n\ |
Line 4182... | Line 4196... | ||
4182 | while(userdraw_x[p]){\ |
4196 | while(userdraw_x[p]){\ |
4183 | reply[p] = userdraw_x[p] +\":\" + userdraw_y[p];\ |
4197 | reply[p] = userdraw_x[p] +\":\" + userdraw_y[p];\ |
4184 | p++;\ |
4198 | p++;\ |
4185 | };\ |
4199 | };\ |
4186 | if(p == 0){alert(\"nothing drawn...\");return;};\ |
4200 | if(p == 0){alert(\"nothing drawn...\");return;};\ |
4187 | if( document.getElementById(\"canvas_input0\") ){\ |
4201 | if( document.getElementById(\"canvas_input0\") ){\ |
4188 | var p = 0;var input_reply = new Array();\ |
- | |
4189 | if( document.getElementById(\"canvas_input0\")){\ |
- | |
4190 | var t = 0;\ |
- | |
4191 | while(document.getElementById(\"canvas_input\"+t)){\ |
- | |
4192 | if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\ |
- | |
4193 | input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\ |
- | |
4194 | p++;\ |
- | |
4195 | };\ |
- | |
4196 | t++;\ |
- | |
4197 | };\ |
- | |
4198 | };\ |
- | |
4199 | if( typeof userdraw_text != 'undefined' ){\ |
- | |
4200 | return reply+\"\\n\"+input_reply+\"\\n\"+userdraw_text;\ |
- | |
4201 | }\ |
- | |
4202 | else\ |
- | |
4203 | {\ |
- | |
4204 | return reply+\"\\n\"+input_reply;\ |
- | |
4205 | }\ |
- | |
4206 | }\ |
- | |
4207 | else\ |
- | |
4208 | {\ |
- | |
4209 | if( typeof userdraw_text != 'undefined' ){\ |
- | |
4210 | return reply+\"\\n\"+userdraw_text;\ |
- | |
4211 | }\ |
- | |
4212 | else\ |
- | |
4213 | {\ |
- | |
4214 | return reply;\ |
- | |
4215 | }\ |
- | |
4216 | };\ |
- | |
4217 | };\n\ |
- | |
4218 | <!-- end function 7 read_canvas%d() -->",canvas_root_id,canvas_root_id,canvas_root_id); |
- | |
4219 | break; |
- | |
4220 | case 8: fprintf(js_include_file,"\ |
- | |
4221 | \n<!-- begin function 8 read_canvas%d() -->\n\ |
- | |
4222 | read_canvas%d = function(){\ |
- | |
4223 | var reply = new Array();\ |
- | |
4224 | var p = 0;\ |
- | |
4225 | var prec = %d;\ |
- | |
4226 | while(userdraw_x[p]){\ |
- | |
4227 | reply[p] = (Math.round(prec*(px2x(userdraw_x[p]))))/prec +\":\" + (Math.round(prec*(px2y(userdraw_y[p]))))/prec;\ |
- | |
4228 | p++;\ |
- | |
4229 | };\ |
- | |
4230 | if(p == 0){alert(\"nothing drawn...\");return;};\ |
- | |
4231 | if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\ |
- | |
4232 | var p = 0;var input_reply = new Array();\ |
4202 | var p = 0;var input_reply = new Array();\ |
4233 | if( document.getElementById(\"canvas_input0\")){\ |
4203 | if( document.getElementById(\"canvas_input0\")){\ |
4234 | var t = 0;\ |
4204 | var t = 0;\ |
4235 | while(document.getElementById(\"canvas_input\"+t)){\ |
4205 | while(document.getElementById(\"canvas_input\"+t)){\ |
4236 | if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\ |
4206 | if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\ |
Line 4239... | Line 4209... | ||
4239 | };\ |
4209 | };\ |
4240 | t++;\ |
4210 | t++;\ |
4241 | };\ |
4211 | };\ |
4242 | };\ |
4212 | };\ |
4243 | if( typeof userdraw_text != 'undefined' ){\ |
4213 | if( typeof userdraw_text != 'undefined' ){\ |
4244 | return reply |
4214 | return reply+\"\\n\"+input_reply+\"\\n\"+userdraw_text;\ |
4245 | }\ |
4215 | }\ |
4246 | else\ |
4216 | else\ |
4247 | {\ |
4217 | {\ |
- | 4218 | return reply+\"\\n\"+input_reply;\ |
|
- | 4219 | }\ |
|
- | 4220 | }\ |
|
- | 4221 | else\ |
|
- | 4222 | {\ |
|
- | 4223 | if( typeof userdraw_text != 'undefined' ){\ |
|
- | 4224 | return reply+\"\\n\"+userdraw_text;\ |
|
- | 4225 | }\ |
|
- | 4226 | else\ |
|
- | 4227 | {\ |
|
- | 4228 | return reply;\ |
|
- | 4229 | }\ |
|
- | 4230 | };\ |
|
- | 4231 | };\n\ |
|
- | 4232 | <!-- end function 7 read_canvas%d() -->",canvas_root_id,canvas_root_id,canvas_root_id); |
|
- | 4233 | break; |
|
- | 4234 | case 8: fprintf(js_include_file,"\ |
|
- | 4235 | \n<!-- begin function 8 read_canvas%d() -->\n\ |
|
- | 4236 | read_canvas%d = function(){\ |
|
- | 4237 | var reply = new Array();\ |
|
- | 4238 | var p = 0;\ |
|
- | 4239 | var prec = %d;\ |
|
- | 4240 | while(userdraw_x[p]){\ |
|
- | 4241 | reply[p] = (Math.round(prec*(px2x(userdraw_x[p]))))/prec +\":\" + (Math.round(prec*(px2y(userdraw_y[p]))))/prec;\ |
|
- | 4242 | p++;\ |
|
- | 4243 | };\ |
|
- | 4244 | if(p == 0){alert(\"nothing drawn...\");return;};\ |
|
- | 4245 | if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\ |
|
- | 4246 | var p = 0;var input_reply = new Array();\ |
|
- | 4247 | if( document.getElementById(\"canvas_input0\")){\ |
|
- | 4248 | var t = 0;\ |
|
- | 4249 | while(document.getElementById(\"canvas_input\"+t)){\ |
|
- | 4250 | if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\ |
|
- | 4251 | input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\ |
|
- | 4252 | p++;\ |
|
- | 4253 | };\ |
|
- | 4254 | t++;\ |
|
- | 4255 | };\ |
|
- | 4256 | };\ |
|
- | 4257 | if( typeof userdraw_text != 'undefined' ){\ |
|
- | 4258 | return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\ |
|
- | 4259 | }\ |
|
- | 4260 | else\ |
|
- | 4261 | {\ |
|
4248 | return reply +\"\\n\"+input_reply;\ |
4262 | return reply +\"\\n\"+input_reply;\ |
4249 | }\ |
4263 | }\ |
4250 | }\ |
4264 | }\ |
4251 | else\ |
4265 | else\ |
4252 | {\ |
4266 | {\ |
4253 | if( typeof userdraw_text != 'undefined' ){\ |
4267 | if( typeof userdraw_text != 'undefined' ){\ |
Line 4359... | Line 4373... | ||
4359 | reply = reply + (Math.round(prec*(px2x(userdraw_x[p]))))/prec +\",\" + (Math.round(prec*(px2y(userdraw_y[p]))))/prec +\",\" + (Math.round(prec*(px2x(userdraw_x[p+1]))))/prec +\",\" + (Math.round(prec*(px2y(userdraw_y[p+1]))))/prec +\"\\n\" ;\ |
4373 | reply = reply + (Math.round(prec*(px2x(userdraw_x[p]))))/prec +\",\" + (Math.round(prec*(px2y(userdraw_y[p]))))/prec +\",\" + (Math.round(prec*(px2x(userdraw_x[p+1]))))/prec +\",\" + (Math.round(prec*(px2y(userdraw_y[p+1]))))/prec +\"\\n\" ;\ |
4360 | p = p+2;\ |
4374 | p = p+2;\ |
4361 | };\ |
4375 | };\ |
4362 | if(p == 0){alert(\"nothing drawn...\");return;};\ |
4376 | if(p == 0){alert(\"nothing drawn...\");return;};\ |
4363 | if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\ |
4377 | if( document.getElementById(\"canvas_input0\") || document.getElementById(\"mathml0\") ){\ |
4364 | var p = 0;var input_reply = new Array();\ |
4378 | var p = 0;var input_reply = new Array();\ |
4365 | if( document.getElementById(\"canvas_input0\")){\ |
4379 | if( document.getElementById(\"canvas_input0\")){\ |
4366 | var t = 0;\ |
4380 | var t = 0;\ |
4367 | while(document.getElementById(\"canvas_input\"+t)){\ |
4381 | while(document.getElementById(\"canvas_input\"+t)){\ |
4368 | if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\ |
4382 | if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\ |
4369 | input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\ |
4383 | input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\ |
4370 | p++;\ |
4384 | p++;\ |
4371 | };\ |
4385 | };\ |
4372 | t++;\ |
4386 | t++;\ |
4373 | };\ |
4387 | };\ |
4374 | };\ |
4388 | };\ |
4375 | if( typeof userdraw_text != 'undefined' ){\ |
4389 | if( typeof userdraw_text != 'undefined' ){\ |
4376 | return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\ |
4390 | return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\ |
4377 | }\ |
4391 | }\ |
4378 | else\ |
4392 | else\ |
4379 | {\ |
4393 | {\ |
4380 | return reply +\"\\n\"+input_reply;\ |
4394 | return reply +\"\\n\"+input_reply;\ |
4381 | }\ |
4395 | }\ |
4382 | }\ |
4396 | }\ |
4383 | else\ |
4397 | else\ |
4384 | {\ |
4398 | {\ |
4385 | if( typeof userdraw_text != 'undefined' ){\ |
4399 | if( typeof userdraw_text != 'undefined' ){\ |
4386 | return reply +\"\\n\"+userdraw_text;\ |
4400 | return reply +\"\\n\"+userdraw_text;\ |
4387 | }\ |
4401 | }\ |
4388 | else\ |
4402 | else\ |
4389 | {\ |
4403 | {\ |
Line 4400... | Line 4414... | ||
4400 | var reply = \"\";\ |
4414 | var reply = \"\";\ |
4401 | var p = 0;\ |
4415 | var p = 0;\ |
4402 | for(p = 0; p< userdraw_x.lenght;p = p+2){\ |
4416 | for(p = 0; p< userdraw_x.lenght;p = p+2){\ |
4403 | if(userdraw_x[p] != null){\ |
4417 | if(userdraw_x[p] != null){\ |
4404 | reply = reply + userdraw_x[p] +\",\" + userdraw_y[p] +\",\" + userdraw_x[p+1] +\",\" + userdraw_y[p+1] +\"\\n\" ;\ |
4418 | reply = reply + userdraw_x[p] +\",\" + userdraw_y[p] +\",\" + userdraw_x[p+1] +\",\" + userdraw_y[p+1] +\"\\n\" ;\ |
4405 | };\ |
4419 | };\ |
4406 | };\ |
4420 | };\ |
4407 | if(p == 0){alert(\"nothing drawn...\");return;};\ |
4421 | if(p == 0){alert(\"nothing drawn...\");return;};\ |
4408 | if( document.getElementById(\"canvas_input0\") ){\ |
4422 | if( document.getElementById(\"canvas_input0\") ){\ |
4409 | var p = 0;var input_reply = new Array();\ |
4423 | var p = 0;var input_reply = new Array();\ |
4410 | if( document.getElementById(\"canvas_input0\")){\ |
4424 | if( document.getElementById(\"canvas_input0\")){\ |
4411 | var t = 0;\ |
4425 | var t = 0;\ |
4412 | while(document.getElementById(\"canvas_input\"+t)){\ |
4426 | while(document.getElementById(\"canvas_input\"+t)){\ |
4413 | if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\ |
4427 | if( ! document.getElementById(\"canvas_input\"+t).getAttribute(\"readonly\")){\ |
4414 | input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\ |
4428 | input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\ |
4415 | p++;\ |
4429 | p++;\ |
4416 | };\ |
4430 | };\ |
4417 | t++;\ |
4431 | t++;\ |
4418 | };\ |
4432 | };\ |
4419 | };\ |
4433 | };\ |
4420 | if( typeof userdraw_text != 'undefined' ){\ |
4434 | if( typeof userdraw_text != 'undefined' ){\ |
4421 | return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\ |
4435 | return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\ |
4422 | }\ |
4436 | }\ |
4423 | else\ |
4437 | else\ |
4424 | {\ |
4438 | {\ |
4425 | return reply +\"\\n\"+input_reply;\ |
4439 | return reply +\"\\n\"+input_reply;\ |
4426 | }\ |
4440 | }\ |
4427 | }\ |
4441 | }\ |
4428 | else\ |
4442 | else\ |
4429 | {\ |
4443 | {\ |
4430 | if( typeof userdraw_text != 'undefined' ){\ |
4444 | if( typeof userdraw_text != 'undefined' ){\ |
4431 | return reply +\"\\n\"+userdraw_text\ |
4445 | return reply +\"\\n\"+userdraw_text\ |
4432 | }\ |
4446 | }\ |
4433 | else\ |
4447 | else\ |
4434 | {\ |
4448 | {\ |
4435 | return reply;\ |
4449 | return reply;\ |
4436 | }\ |
4450 | }\ |
4437 | };\ |
4451 | };\ |
4438 | };\n\ |
4452 | };\n\ |
4439 | <!-- end function 12 read_canvas%d() -->",canvas_root_id,canvas_root_id,canvas_root_id); |
4453 | <!-- end function 12 read_canvas%d() -->",canvas_root_id,canvas_root_id,canvas_root_id); |
4440 | break; |
4454 | break; |
4441 | case 13: fprintf(js_include_file,"\ |
4455 | case 13: fprintf(js_include_file,"\ |
Line 4459... | Line 4473... | ||
4459 | p++;\ |
4473 | p++;\ |
4460 | };\ |
4474 | };\ |
4461 | t++;\ |
4475 | t++;\ |
4462 | };\ |
4476 | };\ |
4463 | };\ |
4477 | };\ |
4464 | if( typeof userdraw_text != 'undefined' ){\ |
4478 | if( typeof userdraw_text != 'undefined' ){\ |
4465 | return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\ |
4479 | return reply +\"\\n\"+input_reply+\"\\n\"+userdraw_text;\ |
4466 | }\ |
4480 | }\ |
4467 | else\ |
4481 | else\ |
4468 | {\ |
4482 | {\ |
4469 | return reply +\"\\n\"+input_reply;\ |
4483 | return reply +\"\\n\"+input_reply;\ |
Line 4471... | Line 4485... | ||
4471 | }\ |
4485 | }\ |
4472 | else\ |
4486 | else\ |
4473 | {\ |
4487 | {\ |
4474 | if( typeof userdraw_text != 'undefined' ){\ |
4488 | if( typeof userdraw_text != 'undefined' ){\ |
4475 | return reply +\"\\n\"+userdraw_text\ |
4489 | return reply +\"\\n\"+userdraw_text\ |
4476 | }\ |
4490 | }\ |
4477 | else\ |
4491 | else\ |
4478 | {\ |
4492 | {\ |
4479 | return reply;\ |
4493 | return reply;\ |
4480 | }\ |
4494 | }\ |
4481 | };\ |
4495 | };\ |
4482 | };\n\ |
4496 | };\n\ |
4483 | <!-- end function 13 read_canvas%d() -->",canvas_root_id,canvas_root_id,reply_precision,canvas_root_id); |
4497 | <!-- end function 13 read_canvas%d() -->",canvas_root_id,canvas_root_id,reply_precision,canvas_root_id); |
Line 4699... | Line 4713... | ||
4699 | }\ |
4713 | }\ |
4700 | else\ |
4714 | else\ |
4701 | {\ |
4715 | {\ |
4702 | if( typeof userdraw_text != 'undefined' ){\ |
4716 | if( typeof userdraw_text != 'undefined' ){\ |
4703 | return reply +\"\\n\"+userdraw_text;\ |
4717 | return reply +\"\\n\"+userdraw_text;\ |
4704 | }\ |
4718 | }\ |
4705 | else\ |
4719 | else\ |
4706 | {\ |
4720 | {\ |
4707 | return reply;\ |
4721 | return reply;\ |
4708 | }\ |
4722 | }\ |
4709 | };\ |
4723 | };\ |
4710 | };\n\ |
4724 | };\n\ |
Line 4722... | Line 4736... | ||
4722 | for(var i = 0; i < lu - 1 ; i++ ){\ |
4736 | for(var i = 0; i < lu - 1 ; i++ ){\ |
4723 | if( Math.abs(userdraw_x[i] - userdraw_x[i+1])){\ |
4737 | if( Math.abs(userdraw_x[i] - userdraw_x[i+1])){\ |
4724 | reply_x[p] = (Math.round(prec*(px2x(userdraw_x[i]))))/prec;reply_y[p] = (Math.round(prec*(px2y(userdraw_y[i]))))/prec;\ |
4738 | reply_x[p] = (Math.round(prec*(px2x(userdraw_x[i]))))/prec;reply_y[p] = (Math.round(prec*(px2y(userdraw_y[i]))))/prec;\ |
4725 | if( isNaN(reply_x[p]) || isNaN(reply_y[p]) ){ alert(\"hmmmm ?\");return; };\ |
4739 | if( isNaN(reply_x[p]) || isNaN(reply_y[p]) ){ alert(\"hmmmm ?\");return; };\ |
4726 | p++;\ |
4740 | p++;\ |
4727 | };\ |
4741 | };\ |
4728 | reply_x[p] = (Math.round(prec*(px2x(userdraw_x[lu-1]))))/prec;reply_y[p] = (Math.round(prec*(px2y(userdraw_y[lu-1]))))/prec;\ |
4742 | reply_x[p] = (Math.round(prec*(px2x(userdraw_x[lu-1]))))/prec;reply_y[p] = (Math.round(prec*(px2y(userdraw_y[lu-1]))))/prec;\ |
4729 | };\ |
4743 | };\ |
4730 | if( document.getElementById(\"canvas_input0\")){\ |
4744 | if( document.getElementById(\"canvas_input0\")){\ |
4731 | var p = 0;var input_reply = new Array();\ |
4745 | var p = 0;var input_reply = new Array();\ |
4732 | if( document.getElementById(\"canvas_input0\")){\ |
4746 | if( document.getElementById(\"canvas_input0\")){\ |
Line 4736... | Line 4750... | ||
4736 | input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\ |
4750 | input_reply[p] = document.getElementById(\"canvas_input\"+t).value;\ |
4737 | p++;\ |
4751 | p++;\ |
4738 | };\ |
4752 | };\ |
4739 | t++;\ |
4753 | t++;\ |
4740 | };\ |
4754 | };\ |
4741 | };\ |
4755 | };\ |
4742 | if( typeof userdraw_text != 'undefined' ){\ |
4756 | if( typeof userdraw_text != 'undefined' ){\ |
4743 | return reply_x+\"\\n\"+reply_y+\"\\n\"+input_reply+\"\\n\"+userdraw_text;\ |
4757 | return reply_x+\"\\n\"+reply_y+\"\\n\"+input_reply+\"\\n\"+userdraw_text;\ |
4744 | }\ |
4758 | }\ |
4745 | else\ |
4759 | else\ |
4746 | {\ |
4760 | {\ |
4747 | return reply_x+\"\\n\"+reply_y+\"\\n\"+input_reply;\ |
4761 | return reply_x+\"\\n\"+reply_y+\"\\n\"+input_reply;\ |
4748 | }\ |
4762 | }\ |
4749 | }\ |
4763 | }\ |
4750 | else\ |
4764 | else\ |
4751 | {\ |
4765 | {\ |
4752 | if( typeof userdraw_text != 'undefined' ){\ |
4766 | if( typeof userdraw_text != 'undefined' ){\ |
4753 | return reply_x+\"\\n\"+reply_y+\"\\n\"+userdraw_text;\ |
4767 | return reply_x+\"\\n\"+reply_y+\"\\n\"+userdraw_text;\ |
Line 4757... | Line 4771... | ||
4757 | return reply_x+\"\\n\"+reply_y;\ |
4771 | return reply_x+\"\\n\"+reply_y;\ |
4758 | };\ |
4772 | };\ |
4759 | };\ |
4773 | };\ |
4760 | };\n\ |
4774 | };\n\ |
4761 | <!-- end function 23 read_canvas%d() -->",canvas_root_id,canvas_root_id,reply_precision,canvas_root_id); |
4775 | <!-- end function 23 read_canvas%d() -->",canvas_root_id,canvas_root_id,reply_precision,canvas_root_id); |
4762 | break; |
4776 | break; |
4763 | case 24: fprintf(js_include_file,"\n\ |
4777 | case 24: fprintf(js_include_file,"\n\ |
4764 | <!-- begin function 24 read_canvas%d() -->\n\ |
4778 | <!-- begin function 24 read_canvas%d() -->\n\ |
4765 | read_canvas%d = function(){\ |
4779 | read_canvas%d = function(){\ |
4766 | var input_reply = new Array();\ |
4780 | var input_reply = new Array();\ |
4767 | var p = 0;\ |
4781 | var p = 0;\ |
Line 4775... | Line 4789... | ||
4775 | };\n\ |
4789 | };\n\ |
4776 | <!-- end function 24 read_canvas%d() -->",canvas_root_id,canvas_root_id,canvas_root_id); |
4790 | <!-- end function 24 read_canvas%d() -->",canvas_root_id,canvas_root_id,canvas_root_id); |
4777 | break; |
4791 | break; |
4778 | case 25: |
4792 | case 25: |
4779 | fprintf(js_include_file,"\n<!-- begin function 25 read_canvas%d() : angle(s) in degrees-->\n\ |
4793 | fprintf(js_include_file,"\n<!-- begin function 25 read_canvas%d() : angle(s) in degrees-->\n\ |
4780 | read_canvas%d = function(){\ |
4794 | read_canvas%d = function(){\ |
4781 | if( userdraw_radius.length < 1){alert(\"nothing drawn...\");return;}\ |
4795 | if( userdraw_radius.length < 1){alert(\"nothing drawn...\");return;}\ |
4782 | var lu = userdraw_radius.length;\ |
4796 | var lu = userdraw_radius.length;\ |
4783 | var prec = %d;\ |
4797 | var prec = %d;\ |
4784 | var angle_reply = new Array(lu);\ |
4798 | var angle_reply = new Array(lu);\ |
4785 | for(var p = 0 ; p < lu ; p++){\ |
4799 | for(var p = 0 ; p < lu ; p++){\ |
4786 | angle_reply[p] = (Math.round(prec*180*(userdraw_radius[p])/Math.PI))/prec;\ |
4800 | angle_reply[p] = (Math.round(prec*180*(userdraw_radius[p])/Math.PI))/prec;\ |
4787 | };\ |
4801 | };\ |
4788 | return angle_reply;\ |
4802 | return angle_reply;\ |
Line 4792... | Line 4806... | ||
4792 | case 26: |
4806 | case 26: |
4793 | fprintf(js_include_file,"\n<!-- begin function 26 read_canvas%d() : angle(s) in radians-->\n\ |
4807 | fprintf(js_include_file,"\n<!-- begin function 26 read_canvas%d() : angle(s) in radians-->\n\ |
4794 | read_canvas%d = function(){\ |
4808 | read_canvas%d = function(){\ |
4795 | if( userdraw_radius.length < 1){alert(\"nothing drawn...\");return;}\ |
4809 | if( userdraw_radius.length < 1){alert(\"nothing drawn...\");return;}\ |
4796 | var lu = userdraw_radius.length;\ |
4810 | var lu = userdraw_radius.length;\ |
4797 | var prec = %d;\ |
4811 | var prec = %d;\ |
4798 | var angle_reply = new Array(lu);\ |
4812 | var angle_reply = new Array(lu);\ |
4799 | for(var p = 0 ; p < lu ; p++){\ |
4813 | for(var p = 0 ; p < lu ; p++){\ |
4800 | angle_reply[p] = (Math.round(prec*(userdraw_radius[p])))/prec;\ |
4814 | angle_reply[p] = (Math.round(prec*(userdraw_radius[p])))/prec;\ |
4801 | };\ |
4815 | };\ |
4802 | return angle_reply;\ |
4816 | return angle_reply;\ |
Line 4814... | Line 4828... | ||
4814 | reply[p] = (Math.round(prec*(px2x(userdraw_x[p]))))/prec+\":\"+(Math.round(prec*(px2y(userdraw_y[p]))))/prec+\":\"+ document.getElementById(\"canvas_input\"+p).value;\ |
4828 | reply[p] = (Math.round(prec*(px2x(userdraw_x[p]))))/prec+\":\"+(Math.round(prec*(px2y(userdraw_y[p]))))/prec+\":\"+ document.getElementById(\"canvas_input\"+p).value;\ |
4815 | };\ |
4829 | };\ |
4816 | return reply;\ |
4830 | return reply;\ |
4817 | };\n\ |
4831 | };\n\ |
4818 | <!-- end function 27 read_canvas%d() -->",canvas_root_id,canvas_root_id,reply_precision,canvas_root_id); |
4832 | <!-- end function 27 read_canvas%d() -->",canvas_root_id,canvas_root_id,reply_precision,canvas_root_id); |
- | 4833 | break; |
|
- | 4834 | case 28: |
|
- | 4835 | fprintf(js_include_file,"\n<!-- begin function 28 read_canvas%d() -->\n\ |
|
- | 4836 | read_canvas%d = function(){\ |
|
- | 4837 | var prec = %d;\ |
|
- | 4838 | var reply = new Array();var p = 0;\ |
|
- | 4839 | var idx = 0;\ |
|
- | 4840 | while(userdraw_x[p]){\ |
|
- | 4841 | reply[idx] = (Math.round(prec*(px2x(userdraw_x[p]))))/prec;\ |
|
- | 4842 | idx++;\ |
|
- | 4843 | reply[idx] = (Math.round(prec*(px2y(userdraw_y[p]))))/prec;\ |
|
- | 4844 | idx++;\ |
|
- | 4845 | reply[idx] = (Math.round(prec*(px2x(userdraw_radius[p]) - px2x(0))))/prec;\ |
|
- | 4846 | idx++;\ |
|
- | 4847 | p++;\ |
|
- | 4848 | };\ |
|
- | 4849 | if( p == 0){alert(\"nothing drawn...\");return;}\ |
|
- | 4850 | return reply;\ |
|
- | 4851 | };\n\ |
|
- | 4852 | <!-- end function 4 read_canvas%d() -->",canvas_root_id,canvas_root_id,reply_precision,canvas_root_id); |
|
4819 | break; |
4853 | break; |
4820 | default: canvas_error("hmmm unknown replyformat...");break; |
4854 | default: canvas_error("hmmm unknown replyformat...");break; |
4821 | } |
4855 | } |
4822 | return; |
4856 | return; |
4823 | } |
4857 | } |