Rev 16872 | Rev 16892 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 16872 | Rev 16882 | ||
---|---|---|---|
Line 2612... | Line 2612... | ||
2612 | temp = get_string(infile,1); |
2612 | temp = get_string(infile,1); |
2613 | if(use_affine == TRUE ){ transform(2,2);}/* slider will use css-rotate transformation */ |
2613 | if(use_affine == TRUE ){ transform(2,2);}/* slider will use css-rotate transformation */ |
2614 | if( use_offset != 0 || drag_type != -1 ){int_data[2] = 1;}else{int_data[2] = 0;} /* only centered or not-centered */ |
2614 | if( use_offset != 0 || drag_type != -1 ){int_data[2] = 1;}else{int_data[2] = 0;} /* only centered or not-centered */ |
2615 | int_data[0] = x2px(double_data[0]); |
2615 | int_data[0] = x2px(double_data[0]); |
2616 | int_data[1] = y2px(double_data[1]); |
2616 | int_data[1] = y2px(double_data[1]); |
2617 | if( use_slider != -1 && onclick == 0 ){ onclick = |
2617 | if( use_slider != -1 && onclick == 0 ){ onclick = 5;} |
2618 | if( use_slider != -1 && drag_type != -1){ onclick = 5; } |
2618 | if( use_slider != -1 && drag_type != -1){ onclick = 5; } |
2619 | #ifdef KATEX_INSTALLED |
2619 | #ifdef KATEX_INSTALLED |
2620 | if( strstr(temp,"\\") != 0 ){ temp = str_replace(temp,"\\","\\\\"); } |
2620 | if( strstr(temp,"\\") != 0 ){ temp = str_replace(temp,"\\","\\\\"); } |
2621 | if( strstr(temp,"\"") != 0 ){ temp = str_replace(temp,"\"","'"); } |
2621 | if( strstr(temp,"\"") != 0 ){ temp = str_replace(temp,"\"","'"); } |
2622 | string_length = 1 + snprintf(NULL,0,"var draw_xml%d = {id:%d,type:'katex',x:[%d],y:[%d],mathml:\"%s\",drag_type:%d,onclick:%d,object_cnt:%d,stroke_color:\"%s\",stroke_opacity:%.2f,fill_color:\"%s\",fill_opacity:%.2f,use_center:%d,use_snap:%d,angle:%f,fontfamily:\"%s\",transform:%s,use_affine:%d,offset:[0,0],use_slider:%s,rotation_center:%s,once:true} |
2622 | string_length = 1 + snprintf(NULL,0,"var draw_xml%d = {id:%d,type:'katex',x:[%d],y:[%d],mathml:\"%s\",drag_type:%d,onclick:%d,object_cnt:%d,stroke_color:\"%s\",stroke_opacity:%.2f,fill_color:\"%s\",fill_opacity:%.2f,use_center:%d,use_snap:%d,angle:%f,fontfamily:\"%s\",transform:%s,use_affine:%d,offset:[0,0],use_slider:%s,rotation_center:%s,once:true};draw_xml(draw_xml%d);\n",drawxml_cnt,drawxml_cnt,int_data[0],int_data[1],temp,drag_type,onclick,object_cnt,stroke_color,stroke_opacity,fill_color,fill_opacity,int_data[2],use_snap,angle,font_family,doubledata2js_array(affine_matrix,6,decimals),use_affine,my_sliders,rotation_center,drawxml_cnt); |
2623 | check_string_length(string_length);tmp_buffer = my_newmem(string_length); |
2623 | check_string_length(string_length);tmp_buffer = my_newmem(string_length); |
2624 | snprintf(tmp_buffer,string_length, "var draw_xml%d = {id:%d,type:'katex',x:[%d],y:[%d],mathml:\"%s\",drag_type:%d,onclick:%d,object_cnt:%d,stroke_color:\"%s\",stroke_opacity:%.2f,fill_color:\"%s\",fill_opacity:%.2f,use_center:%d,use_snap:%d,angle:%f,fontfamily:\"%s\",transform:%s,use_affine:%d,offset:[0,0],use_slider:%s,rotation_center:%s,once:true} |
2624 | snprintf(tmp_buffer,string_length, "var draw_xml%d = {id:%d,type:'katex',x:[%d],y:[%d],mathml:\"%s\",drag_type:%d,onclick:%d,object_cnt:%d,stroke_color:\"%s\",stroke_opacity:%.2f,fill_color:\"%s\",fill_opacity:%.2f,use_center:%d,use_snap:%d,angle:%f,fontfamily:\"%s\",transform:%s,use_affine:%d,offset:[0,0],use_slider:%s,rotation_center:%s,once:true};draw_xml(draw_xml%d);\n",drawxml_cnt,drawxml_cnt,int_data[0],int_data[1],temp,drag_type,onclick,object_cnt,stroke_color,stroke_opacity,fill_color,fill_opacity,int_data[2],use_snap,angle,font_family,doubledata2js_array(affine_matrix,6,decimals),use_affine,my_sliders,rotation_center,drawxml_cnt); |
2625 | #else |
2625 | #else |
2626 | temp = getMML(temp);/* generate MathML for Firefox or MathJaX */ |
2626 | temp = getMML(temp);/* generate MathML for Firefox or MathJaX */ |
2627 | if( strstr(temp,"\"") != 0 ){ temp = str_replace(temp,"\"","'"); } |
2627 | if( strstr(temp,"\"") != 0 ){ temp = str_replace(temp,"\"","'"); } |
2628 | string_length = 1 + snprintf(NULL,0,"var draw_xml%d = {id:%d,type:'mathml',x:[%d],y:[%d],mathml:\"%s\",drag_type:%d,onclick:%d,object_cnt:%d,stroke_color:\"%s\",stroke_opacity:%.2f,fill_color:\"%s\",fill_opacity:%.2f,use_center:%d,use_snap:%d,angle:%f,fontfamily:\"%s\",transform:%s,use_affine:%d,offset:[0,0],use_slider:%s,rotation_center:%s,once:true} |
2628 | string_length = 1 + snprintf(NULL,0,"var draw_xml%d = {id:%d,type:'mathml',x:[%d],y:[%d],mathml:\"%s\",drag_type:%d,onclick:%d,object_cnt:%d,stroke_color:\"%s\",stroke_opacity:%.2f,fill_color:\"%s\",fill_opacity:%.2f,use_center:%d,use_snap:%d,angle:%f,fontfamily:\"%s\",transform:%s,use_affine:%d,offset:[0,0],use_slider:%s,rotation_center:%s,once:true};draw_xml(draw_xml%d);\n",drawxml_cnt,drawxml_cnt,int_data[0],int_data[1],temp,drag_type,onclick,object_cnt,stroke_color,stroke_opacity,fill_color,fill_opacity,int_data[2],use_snap,angle,font_family,doubledata2js_array(affine_matrix,6,decimals),use_affine,my_sliders,rotation_center,drawxml_cnt); |
2629 | check_string_length(string_length);tmp_buffer = my_newmem(string_length); |
2629 | check_string_length(string_length);tmp_buffer = my_newmem(string_length); |
2630 | snprintf(tmp_buffer,string_length, "var draw_xml%d = {id:%d,type:'mathml',x:[%d],y:[%d],mathml:\"%s\",drag_type:%d,onclick:%d,object_cnt:%d,stroke_color:\"%s\",stroke_opacity:%.2f,fill_color:\"%s\",fill_opacity:%.2f,use_center:%d,use_snap:%d,angle:%f,fontfamily:\"%s\",transform:%s,use_affine:%d,offset:[0,0],use_slider:%s,rotation_center:%s,once:true} |
2630 | snprintf(tmp_buffer,string_length, "var draw_xml%d = {id:%d,type:'mathml',x:[%d],y:[%d],mathml:\"%s\",drag_type:%d,onclick:%d,object_cnt:%d,stroke_color:\"%s\",stroke_opacity:%.2f,fill_color:\"%s\",fill_opacity:%.2f,use_center:%d,use_snap:%d,angle:%f,fontfamily:\"%s\",transform:%s,use_affine:%d,offset:[0,0],use_slider:%s,rotation_center:%s,once:true};draw_xml(draw_xml%d);\n",drawxml_cnt,drawxml_cnt,int_data[0],int_data[1],temp,drag_type,onclick,object_cnt,stroke_color,stroke_opacity,fill_color,fill_opacity,int_data[2],use_snap,angle,font_family,doubledata2js_array(affine_matrix,6,decimals),use_affine,my_sliders,rotation_center,drawxml_cnt); |
2631 | #endif |
2631 | #endif |
2632 | add_to_buffer(tmp_buffer); |
2632 | add_to_buffer(tmp_buffer); |
2633 | if(onclick != 0 ){object_cnt++;} |
2633 | if(onclick != 0 ){object_cnt++;} |
2634 | drawxml_cnt++;/* keeps track on imported img,div,p,span,mathml,svg */ |
2634 | drawxml_cnt++;/* keeps track on imported img,div,p,span,mathml,svg */ |
2635 | break; |
2635 | break; |
Line 2830... | Line 2830... | ||
2830 | @ default 1 |
2830 | @ default 1 |
2831 | @%linewidth%size 400,400%xrange -10,10%yrange -10,10%linewidth 1%line -5,-5,-5,5,red%linewidth 2%line -4,-5,-4,5,green%linewidth 3%line -3,-5,-3,5,blue%linewidth 4%line -2,-5,-2,5,orange%linewidth 1%line -1,-5,-1,5,brown%linewidth 5%line 1,-5,1,5,cyan%linewidth 6%line 3,-5,3,5,purple%linewidth 7%line 5,-5,5,5,black |
2831 | @%linewidth%size 400,400%xrange -10,10%yrange -10,10%linewidth 1%line -5,-5,-5,5,red%linewidth 2%line -4,-5,-4,5,green%linewidth 3%line -3,-5,-3,5,blue%linewidth 4%line -2,-5,-2,5,orange%linewidth 1%line -1,-5,-1,5,brown%linewidth 5%line 1,-5,1,5,cyan%linewidth 6%line 3,-5,3,5,purple%linewidth 7%line 5,-5,5,5,black |
2832 | */ |
2832 | */ |
2833 | line_width = (int) (get_real(infile,1)); |
2833 | line_width = (int) (get_real(infile,1)); |
2834 | break; |
2834 | break; |
2835 | 2835 | ||
2836 | case LEVELCURVE: |
2836 | case LEVELCURVE: |
2837 | /* |
2837 | /* |
2838 | @ levelcurve color,expression in x/y,l1,l2,... |
2838 | @ levelcurve color,expression in x/y,l1,l2,... |
2839 | @ draws very primitive level curves for expression, with levels l1,l2,l3,...,l_n |
2839 | @ draws very primitive level curves for expression, with levels l1,l2,l3,...,l_n |
2840 | @ the quality is <b>not to be compared</b> with the Flydraw levelcurve. <br />(choose flydraw if you want quality...) |
2840 | @ the quality is <b>not to be compared</b> with the Flydraw levelcurve. <br />(choose flydraw if you want quality...) |
Line 2849... | Line 2849... | ||
2849 | i = 0; |
2849 | i = 0; |
2850 | done = FALSE; |
2850 | done = FALSE; |
2851 | while( !done ){ |
2851 | while( !done ){ |
2852 | double_data[i] = get_real(infile,1); |
2852 | double_data[i] = get_real(infile,1); |
2853 | i++; |
2853 | i++; |
2854 | } |
2854 | } |
2855 | if( use_slider != -1 && onclick == 0){ onclick = 3; }/* no drag&onclick but slideable */ |
2855 | if( use_slider != -1 && onclick == 0){ onclick = 3; }/* no drag&onclick but slideable */ |
2856 | 2856 | ||
2857 | for(c = 0 ; c < i; c++){ |
2857 | for(c = 0 ; c < i; c++){ |
2858 | string_length = 1 + snprintf(NULL,0,"dragstuff.addShape(new Shape(%d,%d,%d,%d,16,%s,[%d],[%d],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,eval_levelcurve(xsize,ysize,fun1,xmin,xmax,ymin,ymax,plot_steps,precision,double_data[c]),line_width,line_width,line_width,stroke_color,stroke_opacity,fill_color,fill_opacity,use_filled,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,my_sliders,rotation_center,use_offset); |
2858 | string_length = 1 + snprintf(NULL,0,"dragstuff.addShape(new Shape(%d,%d,%d,%d,16,%s,[%d],[%d],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,eval_levelcurve(xsize,ysize,fun1,xmin,xmax,ymin,ymax,plot_steps,precision,double_data[c]),line_width,line_width,line_width,stroke_color,stroke_opacity,fill_color,fill_opacity,use_filled,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,my_sliders,rotation_center,use_offset); |
2859 | check_string_length(string_length);tmp_buffer = my_newmem(string_length); |
2859 | check_string_length(string_length);tmp_buffer = my_newmem(string_length); |
Line 2861... | Line 2861... | ||
2861 | add_to_buffer(tmp_buffer); |
2861 | add_to_buffer(tmp_buffer); |
2862 | if(onclick != 0){object_cnt++;} |
2862 | if(onclick != 0){object_cnt++;} |
2863 | /* object_cnt++; */ |
2863 | /* object_cnt++; */ |
2864 | } |
2864 | } |
2865 | dragstuff[16] = 1; |
2865 | dragstuff[16] = 1; |
2866 | if(use_dragstuff == 0 ){ use_dragstuff = 1; } |
2866 | if(use_dragstuff == 0 ){ use_dragstuff = 1; } |
2867 | reset(); |
2867 | reset(); |
2868 | break; |
2868 | break; |
2869 | 2869 | ||
2870 | case LEGEND: |
2870 | case LEGEND: |
2871 | /* |
2871 | /* |
Line 2979... | Line 2979... | ||
2979 | /* |
2979 | /* |
2980 | @ mouse color,fontsize |
2980 | @ mouse color,fontsize |
2981 | @ will display the cursor (x:y) coordinates in ''color`` and ''fontsize`` using default fontfamily Arial |
2981 | @ will display the cursor (x:y) coordinates in ''color`` and ''fontsize`` using default fontfamily Arial |
2982 | @ note: use command ''mouse`` at the end of your script code (the same is true for command ''zoom``) |
2982 | @ note: use command ''mouse`` at the end of your script code (the same is true for command ''zoom``) |
2983 | @%mouse%size 400,400%xrange -10,10%yrange -10,10%mouse red,22 |
2983 | @%mouse%size 400,400%xrange -10,10%yrange -10,10%mouse red,22 |
2984 | */ |
2984 | */ |
2985 | stroke_color = get_color(infile,0); |
2985 | stroke_color = get_color(infile,0); |
2986 | font_size = (int) (get_real(infile,1)); |
2986 | font_size = (int) (get_real(infile,1)); |
2987 | tmp_buffer = my_newmem(26); |
2987 | tmp_buffer = my_newmem(26); |
2988 | snprintf(tmp_buffer,26,"use_mouse_coordinates();\n");add_to_buffer(tmp_buffer); |
2988 | snprintf(tmp_buffer,26,"use_mouse_coordinates();\n");add_to_buffer(tmp_buffer); |
2989 | add_js_mouse(MOUSE_CANVAS,precision,stroke_color,font_size,stroke_opacity,2); |
2989 | add_js_mouse(MOUSE_CANVAS,precision,stroke_color,font_size,stroke_opacity,2); |
2990 | js_function[INTERACTIVE] = 1; |
2990 | js_function[INTERACTIVE] = 1; |
2991 | break; |
2991 | break; |
Line 3071... | Line 3071... | ||
3071 | 3071 | ||
3072 | case MOUSEX: |
3072 | case MOUSEX: |
3073 | /* |
3073 | /* |
3074 | @ mousex color,fontsize |
3074 | @ mousex color,fontsize |
3075 | @ will display the cursor x-coordinate in ''color`` and ''font size`` using the fontfamily Arial. |
3075 | @ will display the cursor x-coordinate in ''color`` and ''font size`` using the fontfamily Arial. |
3076 | @ note: use command ''mouse`` at the end of your script code (the same is true for command ''zoom``). |
3076 | @ note: use command ''mouse`` at the end of your script code (the same is true for command ''zoom``). |
3077 | 3077 | ||
3078 | */ |
3078 | */ |
3079 | stroke_color = get_color(infile,0); |
3079 | stroke_color = get_color(infile,0); |
3080 | font_size = (int) (get_real(infile,1)); |
3080 | font_size = (int) (get_real(infile,1)); |
3081 | tmp_buffer = my_newmem(26); |
3081 | tmp_buffer = my_newmem(26); |
3082 | snprintf(tmp_buffer,26,"use_mouse_coordinates();\n");add_to_buffer(tmp_buffer); |
3082 | snprintf(tmp_buffer,26,"use_mouse_coordinates();\n");add_to_buffer(tmp_buffer); |
3083 | add_js_mouse(MOUSE_CANVAS,precision,stroke_color,font_size,stroke_opacity,0); |
3083 | add_js_mouse(MOUSE_CANVAS,precision,stroke_color,font_size,stroke_opacity,0); |
3084 | js_function[INTERACTIVE] = 1; |
3084 | js_function[INTERACTIVE] = 1; |
3085 | break; |
3085 | break; |
3086 | case MOUSEY: |
3086 | case MOUSEY: |
3087 | /* |
3087 | /* |
3088 | @ mousey color,fontsize |
3088 | @ mousey color,fontsize |
3089 | @ will display the cursor y-coordinate in ''color`` and ''font size`` using default fontfamily Arial. |
3089 | @ will display the cursor y-coordinate in ''color`` and ''font size`` using default fontfamily Arial. |
3090 | @ note: use command ''mouse`` at the end of your script code (the same is true for command ''zoom``). |
3090 | @ note: use command ''mouse`` at the end of your script code (the same is true for command ''zoom``). |
3091 | 3091 | ||
3092 | */ |
3092 | */ |
3093 | stroke_color = get_color(infile,0); |
3093 | stroke_color = get_color(infile,0); |
3094 | font_size = (int) (get_real(infile,1)); |
3094 | font_size = (int) (get_real(infile,1)); |
3095 | tmp_buffer = my_newmem(26); |
3095 | tmp_buffer = my_newmem(26); |
3096 | snprintf(tmp_buffer,26,"use_mouse_coordinates();\n");add_to_buffer(tmp_buffer); |
3096 | snprintf(tmp_buffer,26,"use_mouse_coordinates();\n");add_to_buffer(tmp_buffer); |
3097 | add_js_mouse(MOUSE_CANVAS,precision,stroke_color,font_size,stroke_opacity,1); |
3097 | add_js_mouse(MOUSE_CANVAS,precision,stroke_color,font_size,stroke_opacity,1); |
Line 3103... | Line 3103... | ||
3103 | @ multidash 0,1,1 |
3103 | @ multidash 0,1,1 |
3104 | @ meaning draw objects no. 2 (circle) and 3 (segments), in the list of command like <code>multifill points,circle,segments</code>, are dashed |
3104 | @ meaning draw objects no. 2 (circle) and 3 (segments), in the list of command like <code>multifill points,circle,segments</code>, are dashed |
3105 | @ use before command <a href='#multidraw'>multidraw</a> |
3105 | @ use before command <a href='#multidraw'>multidraw</a> |
3106 | @ if not set all objects will be set ''not dashed``... unless a generic keyword ''dashed`` was given before command ''multidraw`` |
3106 | @ if not set all objects will be set ''not dashed``... unless a generic keyword ''dashed`` was given before command ''multidraw`` |
3107 | @ the dash-type is not -yet- adjustable <br />(e.g. command <code>dashtype line_px,space_px</code> will give no control over multidraw objects) |
3107 | @ the dash-type is not -yet- adjustable <br />(e.g. command <code>dashtype line_px,space_px</code> will give no control over multidraw objects) |
3108 | @ wims will <b>not</b> check if the number of 0 or 1's matches the amount of draw primitives... |
3108 | @ wims will <b>not</b> check if the number of 0 or 1's matches the amount of draw primitives... |
3109 | @ always use the same sequence as is used for ''multidraw`` |
3109 | @ always use the same sequence as is used for ''multidraw`` |
3110 | */ |
3110 | */ |
3111 | if( use_tooltip == 1 ){canvas_error("command 'multidraw' is incompatible with command 'intooltip tip_text'");} |
3111 | if( use_tooltip == 1 ){canvas_error("command 'multidraw' is incompatible with command 'intooltip tip_text'");} |
3112 | temp = get_string(infile,1); |
3112 | temp = get_string(infile,1); |
3113 | temp = str_replace(temp,",","\",\""); |
3113 | temp = str_replace(temp,",","\",\""); |
3114 | fprintf(js_include_file,"var multidash = [\"%s\"];",temp); |
3114 | fprintf(js_include_file,"var multidash = [\"%s\"];",temp); |
3115 | reset();/* if command 'dashed' was given...reset to not-dashed */ |
3115 | reset();/* if command 'dashed' was given...reset to not-dashed */ |
3116 | break; |
3116 | break; |
Line 3595... | Line 3595... | ||
3595 | case 6: int_data[0] = (int) (get_real(infile,0));break; /* n */ |
3595 | case 6: int_data[0] = (int) (get_real(infile,0));break; /* n */ |
3596 | case 7: stroke_color=get_color(infile,1);/* name or hex color */ |
3596 | case 7: stroke_color=get_color(infile,1);/* name or hex color */ |
3597 | string_length = 1 + snprintf(NULL,0,"dragstuff.addShape(new Shape(%d,%d,%d,%d,11,[%.*f,%.*f,%.*f],[%.*f,%.*f,%.*f],[%d,%d,%d],[%d,%d,%d],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,double_data[0],decimals,double_data[2],decimals,double_data[4],decimals,double_data[1],decimals,double_data[3],decimals,double_data[5],int_data[0],int_data[0],int_data[0],int_data[0],int_data[0],int_data[0],line_width,stroke_color,stroke_opacity,fill_color,fill_opacity,use_filled,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,my_sliders,rotation_center,use_offset); |
3597 | string_length = 1 + snprintf(NULL,0,"dragstuff.addShape(new Shape(%d,%d,%d,%d,11,[%.*f,%.*f,%.*f],[%.*f,%.*f,%.*f],[%d,%d,%d],[%d,%d,%d],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,double_data[0],decimals,double_data[2],decimals,double_data[4],decimals,double_data[1],decimals,double_data[3],decimals,double_data[5],int_data[0],int_data[0],int_data[0],int_data[0],int_data[0],int_data[0],line_width,stroke_color,stroke_opacity,fill_color,fill_opacity,use_filled,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,my_sliders,rotation_center,use_offset); |
3598 | check_string_length(string_length);tmp_buffer = my_newmem(string_length); |
3598 | check_string_length(string_length);tmp_buffer = my_newmem(string_length); |
3599 | snprintf(tmp_buffer,string_length,"dragstuff.addShape(new Shape(%d,%d,%d,%d,11,[%.*f,%.*f,%.*f],[%.*f,%.*f,%.*f],[%d,%d,%d],[%d,%d,%d],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,double_data[0],decimals,double_data[2],decimals,double_data[4],decimals,double_data[1],decimals,double_data[3],decimals,double_data[5],int_data[0],int_data[0],int_data[0],int_data[0],int_data[0],int_data[0],line_width,stroke_color,stroke_opacity,fill_color,fill_opacity,use_filled,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,my_sliders,rotation_center,use_offset); |
3599 | snprintf(tmp_buffer,string_length,"dragstuff.addShape(new Shape(%d,%d,%d,%d,11,[%.*f,%.*f,%.*f],[%.*f,%.*f,%.*f],[%d,%d,%d],[%d,%d,%d],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,double_data[0],decimals,double_data[2],decimals,double_data[4],decimals,double_data[1],decimals,double_data[3],decimals,double_data[5],int_data[0],int_data[0],int_data[0],int_data[0],int_data[0],int_data[0],line_width,stroke_color,stroke_opacity,fill_color,fill_opacity,use_filled,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,my_sliders,rotation_center,use_offset); |
3600 | add_to_buffer(tmp_buffer); |
3600 | add_to_buffer(tmp_buffer); |
3601 | if(onclick != 0){object_cnt++;} |
3601 | if(onclick != 0){object_cnt++;} |
3602 | break; |
3602 | break; |
3603 | default: break; |
3603 | default: break; |
3604 | } |
3604 | } |
3605 | dragstuff[11] = 1; |
3605 | dragstuff[11] = 1; |
3606 | } |
3606 | } |
3607 | } |
3607 | } |
Line 3702... | Line 3702... | ||
3702 | @ draw closed polygon |
3702 | @ draw closed polygon |
3703 | @ use command ''fpoly`` to fill it or use keyword <a href='#filled'>filled</a> |
3703 | @ use command ''fpoly`` to fill it or use keyword <a href='#filled'>filled</a> |
3704 | @ may be set <a href="#drag">draggable</a> / <a href="#onclick">onclick</a> |
3704 | @ may be set <a href="#drag">draggable</a> / <a href="#onclick">onclick</a> |
3705 | @%polygon_1%size 400,400%xrange -10,10%yrange -10,10%opacity 255,25%fillcolor orange%filled%linewidth 2%drag xy%snaptogrid%poly blue,0,0,1,3,3,1,2,4,-1,3 |
3705 | @%polygon_1%size 400,400%xrange -10,10%yrange -10,10%opacity 255,25%fillcolor orange%filled%linewidth 2%drag xy%snaptogrid%poly blue,0,0,1,3,3,1,2,4,-1,3 |
3706 | @%polygon_2%size 400,400%xrange -10,10%yrange -10,10%opacity 255,25%fillcolor orange%filled%linewidth 1%onclick%poly green,0,0,1,3,3,1,2,4,-1,3 |
3706 | @%polygon_2%size 400,400%xrange -10,10%yrange -10,10%opacity 255,25%fillcolor orange%filled%linewidth 1%onclick%poly green,0,0,1,3,3,1,2,4,-1,3 |
3707 | */ |
3707 | */ |
3708 | stroke_color=get_color(infile,0); /* how nice: now the color comes first...*/ |
3708 | stroke_color=get_color(infile,0); /* how nice: now the color comes first...*/ |
3709 | i=0; |
3709 | i=0; |
3710 | c=0; |
3710 | c=0; |
3711 | while( ! done ){ /* get next item until EOL*/ |
3711 | while( ! done ){ /* get next item until EOL*/ |
3712 | if(i > MAX_INT - 1){canvas_error("too many points in argument: repeat command multiple times to fit");} |
3712 | if(i > MAX_INT - 1){canvas_error("too many points in argument: repeat command multiple times to fit");} |
3713 | for( c = 0 ; c < 2; c++){ |
3713 | for( c = 0 ; c < 2; c++){ |
3714 | if(c == 0 ){ |
3714 | if(c == 0 ){ |
3715 | double_data[i] = get_real(infile,0); |
3715 | double_data[i] = get_real(infile,0); |
3716 | i++; |
3716 | i++; |
3717 | } |
3717 | } |
3718 | else |
3718 | else |
3719 | { |
3719 | { |
3720 | double_data[i] = get_real(infile,1); |
3720 | double_data[i] = get_real(infile,1); |
3721 | i++; |
3721 | i++; |
3722 | } |
3722 | } |
3723 | } |
3723 | } |
3724 | } |
3724 | } |
3725 | if(use_rotate == TRUE ){rotate(i-1,angle,rotationcenter,2);} |
3725 | if(use_rotate == TRUE ){rotate(i-1,angle,rotationcenter,2);} |
3726 | if(use_affine == TRUE ){ transform(i-1,2);} |
3726 | if(use_affine == TRUE ){ transform(i-1,2);} |
Line 3838... | Line 3838... | ||
3838 | add_to_buffer(tmp_buffer); |
3838 | add_to_buffer(tmp_buffer); |
3839 | reply_precision = precision; |
3839 | reply_precision = precision; |
3840 | /* no reply from protractor if non-interactive */ |
3840 | /* no reply from protractor if non-interactive */ |
3841 | if( reply_format == 0 && int_data[1] == -1 ){reply_format = 30;} |
3841 | if( reply_format == 0 && int_data[1] == -1 ){reply_format = 30;} |
3842 | js_function[INTERACTIVE] = 1; |
3842 | js_function[INTERACTIVE] = 1; |
3843 | break; |
3843 | break; |
3844 | default: break; |
3844 | default: break; |
3845 | } |
3845 | } |
3846 | } |
3846 | } |
3847 | break; |
3847 | break; |
3848 | 3848 | ||
3849 | case PIXELS: |
3849 | case PIXELS: |
3850 | /* |
3850 | /* |
3851 | @ pixels color,x1,y1,x2,y2,x3,y3... |
3851 | @ pixels color,x1,y1,x2,y2,x3,y3... |
3852 | @ draw rectangular "points" with diameter 1 pixel |
3852 | @ draw rectangular "points" with diameter 1 pixel |
Line 4572... | Line 4572... | ||
4572 | break; |
4572 | break; |
4573 | 4573 | ||
4574 | case GROUP: |
4574 | case GROUP: |
4575 | use_slider++; |
4575 | use_slider++; |
4576 | add_slider(2); |
4576 | add_slider(2); |
- | 4577 | no_reset = TRUE; |
|
4577 | int c = 0; |
4578 | int c = 0; |
4578 | for(i=last_slider;i<=use_slider;i++){ int_data[c] = i; c++; } |
4579 | for(i=last_slider;i<=use_slider;i++){ int_data[c] = i; c++; } |
4579 | my_sliders = data2js_array(int_data,use_slider - last_slider+1); |
4580 | my_sliders = data2js_array(int_data,use_slider - last_slider+1); |
4580 | if( precision == 0 ){precision = 100;} |
4581 | if( precision == 0 ){precision = 100;} |
4581 | onclick = |
4582 | onclick = 5; |
4582 | use_dragstuff = 2; |
4583 | use_dragstuff = 2; |
- | 4584 | drag_type = 0; |
|
4583 | js_function[INTERACTIVE] = 1; |
4585 | js_function[INTERACTIVE] = 1; |
4584 | fprintf(js_include_file," |
4586 | fprintf(js_include_file,"var slider%d;dragdrop_precision = %d;use_dragdrop_reply = true;",use_slider,precision); |
4585 |
|
4587 | string_length = 1 + snprintf(NULL,0,"slider%d = new move_group(%d);\n",use_slider); |
- | 4588 | check_string_length(string_length);tmp_buffer = my_newmem(string_length); |
|
- | 4589 | snprintf(tmp_buffer,string_length ,"slider%d = new move_group(%d);\n",use_slider,use_slider); |
|
- | 4590 | add_to_buffer(tmp_buffer); |
|
- | 4591 | ||
4586 | /* |
4592 | /* |
4587 | @ group |
4593 | @ group |
4588 | @ keyword |
4594 | @ keyword |
- | 4595 | @ work in 'progress' |
|
4589 | @ all objects after the command and until <a href="#kill">kill group</a> or <a href="#killslider">killslider</a> may be moved together with mouse moverments |
4596 | @ all objects(*) after the command and until <a href="#kill">kill group</a> or <a href="#killslider">killslider</a> may be moved together with mouse moverments<br /> (*) for now all real canvas objects and latex / xml ; but no images (work in progress) |
4590 | @ may be combined with slider driven movements or drag & drop |
4597 | @ may be combined with slider driven movements or drag & drop |
4591 | @%group%%size 400,400%xrange -10,10%yrange -10,10%axis%axisnumbering%precision 1%grid 2,2,grey,2,2,5,grey%precision 100%linewidth 4%rotationcenter 0,0%slider -2*pi,2*pi,300,40,angle active,rotate%snaptogrid%ftriangle 0,-4,-2,-2,4,--5,blue%fillcolor red%fcircle -4.4,4.4,40,blue%kill slider%slider -20,20,300,40,x active,x-slide%ftriangle -2,0,0,4,2,0,green%fcircle 4.4,4.5,40,red%kill slider%slider -20,20,300,40,y active,y-slide%fcircle 4,-4,40,green%linewidth 4%fcircle -4,-4,40,orange%kill slider%group%fcircle -4.4,4.5,10,blue%fcircle -5.4,4.5,10,blue%fcircle -6.4,4.5,10,blue%fcircle -4.4,8,16,green%fcircle -5.4,8,16,green%fcircle -6.4,8,16,green%mouse red,22%zoom red |
4598 | @%group%%size 400,400%xrange -10,10%yrange -10,10%axis%axisnumbering%precision 1%grid 2,2,grey,2,2,5,grey%precision 100%linewidth 4%rotationcenter 0,0%slider -2*pi,2*pi,300,40,angle active,rotate%snaptogrid%ftriangle 0,-4,-2,-2,4,--5,blue%fillcolor red%fcircle -4.4,4.4,40,blue%kill slider%slider -20,20,300,40,x active,x-slide%ftriangle -2,0,0,4,2,0,green%fcircle 4.4,4.5,40,red%kill slider%slider -20,20,300,40,y active,y-slide%fcircle 4,-4,40,green%linewidth 4%fcircle -4,-4,40,orange%kill slider%group%fcircle -4.4,4.5,10,blue%fcircle -5.4,4.5,10,blue%fcircle -6.4,4.5,10,blue%fcircle -4.4,8,16,green%fcircle -5.4,8,16,green%fcircle -6.4,8,16,green%mouse red,22%zoom red |
4592 | */ |
4599 | */ |
4593 | break; |
4600 | break; |
4594 | case SGRAPH: |
4601 | case SGRAPH: |
4595 | /* |
4602 | /* |